nidium/Nidium

nidium does not start correctly incombination with `entr` AND `find`

verpeteren opened this issue · 6 comments

For the time being, I am using the entr tool to kill and restart nidium when I save a file. That works great with ls but not with find.

This works:

./bin/nidium ../pathtomyapp/index.nml

This works:

ls ./bin/nidium ../pathtomyapp/index.nml ../pathtomyapp/src/* |entr -r ./bin/nidium ../pathtomyapp/index.nml

This gives an error:

find ./bin/nidium ../pathtomyapp/ -type f|entr -r ./bin/nidium ../pathtomyapp/index.nml
NML Parse error lin1 expected <

And the following message in the console.

entr: No regular files to watch

Somehow entr does someting to nidium a signal or a input, and nidium handles that incorrect while it is reading the xml file.

efyx commented

I think that expected. Nidium cannot read an NML from stdin. Is this something we want to support ?

nidium is not reading from stdin, entr is.
entr reads a list of files that it should watch.
entr's -r flag kills the executing process (in this case nidium with the nml) and kills it and starts it again.

So, somehow/somewhere entr does something with nidium (probably during the nml reading) that nidium does not like. IMO nidium should be a little more robust.

efyx commented

Sorry, I misunderstood the initial issue. Since this happen when nidium is restarted by entr can we first make sure nidium is receiving the correct arguments by adding some debugging here : https://github.com/nidium/Nidium/blob/master/src/Frontend/app/linux/main.cpp#L77

Did a simple test : find . -name "*.nml" | entr -r ./nidium crash.nml, seems to work properly.

Just add a breakpoint where @efyx mentioned. My guess is that a bad input file is given somehow. More likely an issue with the cli invocation than nidium.

efyx commented

As a side note, you can do pretty much the same thing using :

#!/bin/bash

while true; do
    inotifywait -e modify,create,delete -r /path/to/your/dir && killall -HUP nidium
done

It was a problem with the cli invokation indeed.
I 'm sorry if i wasted your time.