eradman/entr

Feature request: suppress exit status message with -q

Closed this issue · 7 comments

entr is a great fit for activating a test runner when either the source file or the test file changes: I have a script that sets it up
finishing like this:
ls $CHAPTER $TESTS | entr -psq 'guile -L . -L ~/.guile.lib/ --no-auto-compile tests/$(basename $0)'
in a separate terminal. I think I have to use the -s option so that I can refer both to source and test files at the same time,
but the exit message following every file change is mildly distracting.

I patched it for my own use, but submitted a pr #136 since it would be nice to hand back updating to pacman.

It is true that you need to use -s for $0 to be set, but entr cannot be used to reliably used to compile files this way. /_ or $0 is just the "leading edge", the file that first triggered an event, all other events are discarded.

The intent was to provide an easy way of watching a single file. From the man page:


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

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

Since this comes up periodically I added a Processing Files section at https://eradman.com/entrproject/

The short version is: use a built tool, and use entr to kick it off

ls  $FILES | entr -p make

Let me know if this make sense.

Thanks so much for taking the time for a detailed reply. Perhaps I still have the wrong end of the stick, but I wonder if we are slightly at cross-purposes here, since there is no compiling involved (guile scheme is for this purpose interpreted).

Just to be explicit: my set-up is

  • a tmux pane vim code.scm
  • a tmux pane vim tests/code.scm (which has an include to code.scm)
  • a tmux pane with entr watching these two files and invoking the test runner on the ./test/file.scm when either changes.

The only time the file system changes is when I write from vim. The test runner controlled by entr merely gives a red/green visual indication of failing/passing tests.

From the entr web page I gathered that the possible problems with watching multiple files arise when the files change in a race condition (how fast can I change panes!) or from changes when entr is not running (not relevant in my case). In any case, if the test runner fails to trigger I could just save again. I have been using it for a while, and it works flawlessly. I didn't devise this setup, but picked it up from a tmux user who does a similar thing with python, so it looks like I am not the only one using your fine chisel to open a tin of paint :)

This is the context in which the exit status message is a mild irritant.

Got it..you don't expect "all files to be processed" when changing branches, for example, you're just editing one at a time.

Changing the Tmux background color is a cool idea!

I proposed a change that introduces an environment variable enable a custom exit status message: #138

Hence add this to your .profile to disable the status message

export ENTR_STATUS_COMMAND=""

Another example:

export ENTR_STATUS_COMMAND='echo "== $EXIT_STATUS =="'

Conditional messages

export ENTR_STATUS_COMMAND='[ "$EXIT_STATUS" -eq 0 ] && printf "\xE2\x9C\x94 pass\n" || printf "\xE2\x9D\x8C fail\n"'

#141 takes an entirely different approach:

no status message by default, new -x option for enabling status messages that are configurable

#141 takes an entirely different approach:

no status message by default, new -x option for enabling status messages that are configurable

This looks like a great solution for everyone. Default does nothing suits me best, but the flexibility for future ideas is there.

Yeah, I think people will like quiet by default with the option to customize the status message. Merged for further testing!