Closed ad-ops closed 1 month ago
OK so it looks like -r
the flag to make watchexec restart the program when file change, but due to SIGTTOU
being emitted it does not work. Is that right?
Why does it do that? Is that intended behaviour or a bug in watchexec?
I don’t know much about the underlying issues, but from what I could read the SIGTTOU is sent when a background process tries to write output which it is not allowed to.
It looks like you can disable this with stty -tostop
, but I had no success running it. I was hoping that maybe there was something that could be set with the erlang build scripts to prevent them from not writing (but it seems to have no issues with the GLEAM_LOG set.
Not the most important issue, but I saw many had the issue on discord so if it is not fixable maybe it is possible have a workaround or documentation.
It would be really good to get this working, for sure! I'm keen to understand why it is that watchexec stops when this happens.
How did you work out that it's SIGTTOU and that is causing the issue?
I think it is working as intended, but I wished it could be ignored (should be possible, but I am having some skill-issues:-) ).
I did not try it with different shells (I ran it with zsh) and I will see if using others might help.
It didn't work to change shell, but it works to remove the INPUT (even if there is no input being sent). This is the comment that hinted to this solution.
# works as expected
watchexec -r -e gleam -- gleam run </dev/null
Oh interesting! I must admit I don't understand what is happening here at all. Perhaps we could try not passing stdin to escript
and see if that changes anything?
I am also out of my depth with this, but I do like to watch code for changes:-).
I tried to remove this line, but it made no difference. I just ran the command by itself and still get the same error, so it is somehow disconnected from gleam.
watchexec -r --stop-signal SIGKILL --stop-timeout 5 -e gleam -- escript /Users/myuser/ws/gleam/hello/build/dev/erlang/hello/_gleam_artefacts/gleam@@compile.erl --lib /Users/myuser/ws/gleam/hello/build/dev/erlang --out /Users/adrian.opsahl/ws/gleam/hello/build/dev/erlang/hello/ebin /Users/myuser/ws/gleam/hello/build/dev/erlang/hello/_gleam_artefacts/hello.erl
I don't know enough erlang to understand if there is anything in the code or how escript
works. Still the workaround is good enough for me.
Version
Gleam 1.0.0 Archlinux & MacOs (M2)
Problem
escript
build step sends SIGTTOU after compilation is done causingwatchexec
to hang.Workaround
Using
fd .gleam | entr -r -s 'gleam run'
works fine, but I would rather use watchexec (which some got to work?). If there are any good work arounds I would be glad to use them.Reproduce