cespare / reflex

Run a command when files change

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Basic use case, "executable file not found in $PATH"

Ran4 opened this issue · comments

Terminal input:

$ reflex file.html "/usr/bin/firefox file.html" &
$ echo "content" > file.html
$ [00] exec: "file.html": executable file not found in $PATH

Expected result:
I was expecting "/usr/bin/firefox file.html" to run (exec /usr/bin/firefox file.html works just fine) instead of getting this error.

Why am I getting this problem? Should the unexpected output perhaps be added to README.md? Since this is presumably one of the primary use cases for this tool (which seems great if it worked as I expected).

/usr/bin is in my $PATH.

The above example works perfectly fine in when-changed, which is a similar program (written in Python).

There are two different issues with your usage here.

First, to specify which files you want to listen for, you should use the -r or -g flags.

Second, by putting quotes around "/usr/bin/firefox file.html", you are asking reflex to literally execute a program named "/usr/bin/firefox file.html", space and all. So you don't want the quotes there.

Putting these together:

reflex -g file.html /usr/bin/firefox file.html

or, more generally

reflex -g '*.html' /usr/bin/firefox {}

(That second one will watch/open any html file, not just file.html.)

See the README for more info about how to use reflex.