A utility for running arbitrary commands when files change

Overview

Event Notify Test Runner

A utility for running arbitrary commands when files change. Uses kqueue(2) or inotify(7) to avoid polling. entr was written to make rapid feedback and automated testing natural and completely ordinary.

Source Installation - BSD, Mac OS, and Linux

./configure
make test
make install

To see available build options run ./configure -h

Docker and Windows Subsystem for Linux

Incomplete inotify support on WSL and Docker for Mac can cause entr to respond inconsistently. Since version 4.4, entr includes a workaround: Set the environment variable ENTR_INOTIFY_WORKAROUND.

entr will confirm the workaround is enabled:

entr: broken inotify workaround enabled

Man Page Examples

Rebuild a project if source files change, limiting output to the first 20 lines:

$ find src/ | entr sh -c 'make | head -n 20'

Launch and auto-reload a node.js server:

$ ls *.js | entr -r node app.js

Clear the screen and run a query after the SQL script is updated:

$ echo my.sql | entr -cp psql -f /_

Rebuild project if a source file is modified or added to the src/ directory:

$ while sleep 0.1; do ls src/*.rb | entr -d make; done

Auto-reload a web server, or terminate if the server exits

$ ls * | entr -rz ./httpd

News

A release history as well as features in the upcoming release are covered in the NEWS file.

Issues
  • Entr executes when opening files with nano (Raspberry Pi Zero 1.3)

    Entr executes when opening files with nano (Raspberry Pi Zero 1.3)

    I have encountered a bug when using entr paired with nano/pico on a Raspberry Pi Zero 1.3: Not only when saving a file, but also when opening a file with nano or pico entr will start executing its command.

    I have tested this on 2 different Raspberry Pi Zero 1.3 Models. Here this bug occurs. (I have tested Version 4.1 and 4.9)

    Additionally, I have tested this on my macOS machine (entr 4.8) as well as a Ubuntu Server (entr 4.4) where the bug does not occur. This is how I concluded that is a specific bug on this Raspberry Pi Zero version of Linux.

    opened by tbrodbeck 21
  • Entr does not restart given command on crash

    Entr does not restart given command on crash

    In this case, I'm using entr to restart a Ruby process when source files change.

    Problem: entr does not restart the process when the Ruby process crashes (it's a development environment after all).

    My environment is minikube in MacOS. Live reloading works using the entr inode workaround.

    Is the problem in my configuration or what could cause this?

    2020-02-18 at 11 52

    Entrypoint:

    #! /usr/bin/env bash
    
    set -euo pipefail
    
    _term() {
     >&2 echo "TERM"
     exit 0
    }
    
    trap "_term" TERM
    
    OPERATOR="${1:-}"
    COMMAND="bin/operators/${OPERATOR}"
    
    if [[ -z "${OPERATOR}" ]]; then
      echo "Error: Missing parameter operator name."
      echo "Usage: $0 operator_name"
      exit 1
    elif [[ ! -x "${COMMAND}" ]]; then
      echo "Error: Command '${COMMAND}' is not executable."
      exit 1
    fi
    
    if [[ "${ENV}" = "development" ]]; then
      export ENTR_INOTIFY_WORKAROUND="yespls"
      (
        while true; do
          set +e
            find . | entr -rd "${COMMAND}"
          set -e
        done
      ) &
    else
      set +e
        "${COMMAND}" &
      set -e
    fi
    
    wait $!
    
    opened by pre 15
  • rpi arch64 segmentation fault

    rpi arch64 segmentation fault

    Would be nice it would running on rpi4 64bit. Tried:

    find v-hub.ko | entr sh -c 'clear' [1] 15504 done find v-hub.ko | 15505 segmentation fault entr sh -c 'clear'

    checked on:

    Linux pi 5.10.4-v8+ #1389 SMP PREEMPT Wed Jan 6 13:52:18 GMT 2021 aarch64 GNU/Linux

    opened by Makurisan 12
  • Entr: trying to trigger function while monitoring file change

    Entr: trying to trigger function while monitoring file change

    I'm trying to monitor some files with entr:

    do_it(){ echo Eita!; }
    while true; do ls folder/* more-folder/* | entr -pd do_it; done
    >> entr: exec do_it: No such file or directory
    

    However, this works:

    while true; do ls folder1/* folder2/* | entr -pd echo Eita!; done
    

    What am I doing wrong?

    I am trying to use entr to help me with epub editing. So I this function will trigger an update command to a epub viwer as well as refresh a window in a web browser. (I'd love to see more real examples that would help me doing it...)

    opened by atipico 12
  • Is it possible to use `-r` with an interactive task?

    Is it possible to use `-r` with an interactive task?

    I'd like to use entr to run a command that is interactive. If I don't say 'yes' to the command though, it holds the terminal and so it doesn't re-run unless I interact with that pane. It would be nice to be able to have entr kill the command on updates but still allow me to say 'yes' when I'm ready to let the command apply changes.

    opened by jaresty 12
  • Feature request: pass watched files as command line arg/flag (NOT via pipe)

    Feature request: pass watched files as command line arg/flag (NOT via pipe)

    (Unless of course this feature already exists, in which case, great!)

    I'd like to be able to use entr on Docker images without bash/sh, which means that piping won't be available to me; ideally I would be able to specify files to watch as an arg, e.g.

    ["entr", "--files=a.txt,b.txt,c.txt", "-rz", "my_util.sh"]
    

    (A smaller point in favor of this feature is that while piping makes perfect sense for a call like ls | entr ..., if i just want to watch a single file, it looks a little silly to say echo one-file.txt | entr ...)

    opened by maiamcc 10
  • Please add a shortcut for passing stdin from a file

    Please add a shortcut for passing stdin from a file

    I often find myself using entr to write helper scripts that work on files. I would love it if I could write those scripts to read from stdin and write to stdout, but there isn't a really easy way to do that with entr since it would receive shell redirection if it was done as an argument to the cli itself. It would be nice if there were a built in entr flag to tell it to send stdin to a command from a specific file to make this use case easier.

    opened by jaresty 10
  • Segmentation fault on MacBook M1 due to unlimited file descriptors

    Segmentation fault on MacBook M1 due to unlimited file descriptors

    I get segmentation faults with the latest version of entr (4.7 or git checkout). This happens on a MacBook M1 (Arm chip), running macOS Big Sur, not much changed from the default configuration.

    Backtrace:

    (lldb) process launch -i input.txt  -- -s 'make'
    Process 36108 launched: '/Users/jer/code/entr/entr' (arm64)
    cur: 9223372036854775807
    max: 9223372036854775807
    Process 36108 stopped
    * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
        frame #0: 0x00000001000023d8 entr`process_input(file=0x00000001f9273240, files=0x0000000000000000, max_files=9223372036854775807) at entr.c:305:19
       302 				continue;
       303 			}
       304 			if (S_ISREG(sb.st_mode) != 0) {
    -> 305 				files[n_files] = malloc(sizeof(WatchFile));
       306 				strlcpy(files[n_files]->fn, buf, MEMBER_SIZE(WatchFile, fn));
       307 				files[n_files]->is_dir = 0;
       308 				files[n_files]->file_count = 0;
    

    I added some logging:

    n_files here is 0. max_files is -1.

    After getrlimit(RLIMIT_NOFILE) I get:

    rl.rlim_cur = 9223372036854775807
    rl.rlim_max = 9223372036854775807
    

    that. ~~That's UINT64_MAX~~ That's INT64_MAX. sysconf(_SC_OPEN_MAX) also returns that.

    As rlim_cur is the minimum out of all of that it's INT64_MAX before being passed to process_input. Now process_input takes an int, so it's coerced and becomes -1.

    Seems my file descriptors are unlimited by default:

    $ ulimit -n
    unlimited
    

    Changing it to some more reasonable low number makes entr work as expected:

    $ ulimit -n 1024
    $
    

    Question:

    • Should entr enforce a more reasonable limit for this case?
    • Should process_file maybe not use a different integer type than the one passed in?
    opened by badboy 9
  • docker for mac patch getting old

    docker for mac patch getting old

    The patch file version is http://eradman.com/entrproject/patches/entr-3.9-docker while the entr is at 4.x

    Currently it does apply and the binary seems to work, see https://github.com/matti/docker-entr/blob/master/build/ubuntu/Dockerfile#L13-L17

    Also, could it be possible to include the patch in entr and have the behaviour available as an option? I think I've wasted something like an 2 hours trying to figure out what was wrong with docker-for-mac and entr - just found out https://github.com/eradman/entr/issues/3 by accident

    opened by matti 9
  • Limit 1024 on Linux tells that `entr` is not using inotify

    Limit 1024 on Linux tells that `entr` is not using inotify

    I try to set a build watcher for tflint and get hit by 1024 limit.

    $ fd "\.go$" | entr go build -o ./flt
    entr: Too many files listed; the hard limit for your login class is 1024. Please consult
    http://eradman.com/entrproject/limits.html
    

    But my limit is 8192.

    $ cat /proc/sys/fs/inotify/max_user_watches  
    8192
    

    entr does not use inotify. Why?

    opened by abitrolly 9
  • `entr` to test a game

    `entr` to test a game

    I am developing a small terminal game and decided to use entr to test it. I invoke it like this:

    find src/ -name '*.hs' | entr cabal run invalicabile-nebbia
    

    But when I save a file the game does not get reloaded (I have to quit the game first). -r option seemed alluring, but that blocks input if I understood it correctly. What can I do to make entr work in my case? I can provide repo and compilation instructions if needed.

    opened by ffaf1 8
DollarSkip is a short piece of C code designed to ignore the dollar symbol at the start of commands.

DollarSkip is a short piece of C code designed to ignore the dollar symbol at the start of commands.

null 19 Apr 15, 2022
An implementation of shell commands in C++

ShellSynergy An implementation of shell commands in C++ using std::filesystem Build To run the project execute command: [email protected]:~$ ./RUN.sh Short shel

Vova Makotkin 6 Dec 7, 2021
Three split ergo keyboard with macropad running QMK

IIICC Three piece split keyboard with macropad running QMK Features Split ergo Additional optional macropad with OLED and rotary encoder Central Hub d

null 26 Mar 22, 2022
Universal command-line tagging utility

taxo taxo is a (WIP) universal command-line tagging utility. It manages a database associating items to a set of tags, and implements a simple query l

null 3 Sep 21, 2021
A lightweight utility for parsing PE file formats (EXE, DLL, SYS) written in C/C++

peParser A lightweight utility for parsing PE file formats (EXE, DLL, SYS). Windows Portable Executable (PE) files includes a variety of parsable data

null 17 May 10, 2022
Simple Driver loading command-line utility.

lddrv Simple Driver loading command-line utility. Command Line Load a driver: "lddrv.exe -operation create -binpath C:\Dev\TestDriver.sys -svcname Tes

Josh S. 2 Dec 21, 2021
C++ lib and CLI for playing media files on a Chromecast

castr - a CLI and C++ library to cast media files to Chromecast devices using the built in Default Media Receiver

null 29 Jan 6, 2022
Simple command line tool that processes image files using the FidelityFX Super Resolution (FSR) or Contrast Adaptive Sharpening (CAS) shader systems.

Simple command line tool that processes image files using the FidelityFX Super Resolution (FSR) or Contrast Adaptive Sharpening (CAS) shader systems.

GPUOpen Effects 164 May 3, 2022
Simple command line utilities for extracting data from Fallout 4 and 76 files

fo76utils Simple command line utilities for extracting data from Fallout 4 and 76 files. baunpack - list the contents of, or extract from .BA2 archive

null 6 Apr 10, 2022
A single-class C++ library for reading animated GIF files

EasyGifReader EasyGifReader is a single-class C++ library that aims to simplify reading an animated GIF file. It is built on top of and depends on gif

Viktor Chlumsk√Ĺ 5 Feb 7, 2022
Simple command line tools to create/extract X4 .cat+.dat files

x4cat Simple command line tools to to create/extract X4 .cat+.dat files x4encat Usage: x4encat <archive name> Looks for a directory named <archive nam

Alexander Sago 1 Oct 31, 2021
A command-line tool to extract dylib files from the dyld shared cache file.

DyldExtractor A command-line tool to extract dylib files from the dyld shared cache file. Starting with macOS 11, standalone binaries of system librar

Cyandev 8 Mar 12, 2022
CfgManipulator is a fast and powerful tool for working with configuration files for the C++ language

CfgManipulator is a fast and powerful tool for working with configuration files for the C++ language. It can read, create strings and sections, change the value of a string and much more.

Sanya 2 Jan 28, 2022
A simply GUI to change settings in coreboot's CBFS, via the nvramtool utility.

coreboot-configurator A simple GUI to change settings in coreboot's CBFS, via the nvramtool utility. How to install Ubuntu, Linux Mint, elementary OS,

Star Labs 21 May 6, 2022
Compiles c files automatically on any change

Compiles c files automatically on any change

notaweeb 10 Mar 11, 2022
Watches files and records, or triggers actions, when they change.

Watchman A file watching service. Purpose Watchman exists to watch files and record when they actually change. It can also trigger actions (such as re

Meta 10.9k May 12, 2022
D2R mod generator. Provide quick tool to generate .txt files to change game balance: increase drop, monster density or even randomize items.

Diablo 2 mod generator Generator is inspired by d2modmaker. It provides fast and easy way to create mod without any modding knowledge. Features includ

Smirnov Vladimir 12 May 14, 2022
Signs IPAs on Windows with arbitrary .p12/.mobileprovision files

DumbSigner A mutilated version of Riley Testut's AltServer for Windows to sign IPAs with arbitrary p12 and mobileprovision files on Windows. It works

Raymonf 4 Feb 18, 2022
This project aims to facilitate debugging a kernel driver in windows by adding support for a code change on the fly without reboot/unload, and more!

BSOD Survivor Tired of always telling yourself when you got a BSOD that what if I could just return to the caller function which caused the BSOD, and

Ido Westler 141 May 1, 2022
The DSiLanguagePatcher increases accessibility to foreign region DSi consoles by providing a mean to change the user interface language.

DSi Language Patcher The DSi Language patcher is a small tool, which runs on your DSi (homebrew execution required) and create a copy of your original

null 18 Mar 13, 2022
An asynchronous directory file change watcher module for Windows, macOS and Linux wrapped for V

A V module for asynchronously watching for file changes in a directory. The module is essentially a wrapper for septag/dmon. It works for Windows, macOS and Linux.

null 13 May 9, 2022
Change applications UI labels by hook SetDlgItemTextW(...) in user32.dll.

UI-Injection-Text Change applications UI labels by hook SetDlgItemTextW(...) in user32.dll.

null 1 Oct 24, 2021
A c++ file just to show how can we change color of Background and Text in C++...

A c++ file just to show how can we change color of Background and Text in C++...

null 1 Nov 2, 2021
This repository will hold all the deadly codes that can change the world .

Hacktoberfest Hack Codes Proud Contributors Do you know , that we belong to an era where your code can build me or destry me ? ?? So , we thought why

Aritra Basu 20 Mar 14, 2022
Open-source node system framework, to change your algorithmic code into useful tools to create much more complicated simulations!

Open-source node system framework, to change your algorithmic code into useful tools to create much more complicated simulations!

Zenus Technology 516 May 13, 2022
A third party program to change Minecraft RTX's settings externally, directly in-memory.

RenderBender A third party program to change Minecraft RTX's settings externally, directly in-memory. Get the latest release here. About RenderBender

Jesse Daems 8 Apr 28, 2022
A library for enabling task-based multi-threading. It allows execution of task graphs with arbitrary dependencies.

Fiber Tasking Lib This is a library for enabling task-based multi-threading. It allows execution of task graphs with arbitrary dependencies. Dependenc

RichieSams 761 May 13, 2022
C library for arbitrary-precision ball arithmetic

Arb Arb is a C library for arbitrary-precision interval arithmetic. It has full support for both real and complex numbers. The library is thread-safe,

Fredrik Johansson 360 May 8, 2022
Boot arbitrary iBoot on S5L8747, S5L8947X and S7002, T8002, T8004 ("watch" branch)

Example of building with a different ARM toolchain [email protected] checkm8_bootkit % TOOLCHAIN=/opt/gcc-arm-none-eabi-7-2018-q2-update/bin ARM_CC

john 32 Apr 13, 2022