New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In 1.24.0, ctrl+c no longer interrupts the child process #716
Comments
Hmm. Yeah, that is a regression; I'm surprised I didn't catch it during testing. Maybe I introduced it late. I'll have a look. The |
Fixes #716 by also waiting for processes to quit
Got a fix up, will release later today with your other regression. |
I got a chance to test out this version and it's better but not quite right. Specifically, if the inner command catches the ctrl+c and does not exit immediately, watchexec still does exit immediately, once again creating the awkward situation where I'm at my shell prompt but the command I had run is still writing to the terminal. In particular, Bazel interprets ctrl+c as a request to stop the build, but in some cases waits for in-flight jobs to finish before it actually exits. I think watchexec needs to wait for the inner command to exit before exiting itself. (Thanks for the partial fix though! The severity of the problem is definitely much reduced.) |
Hmm is that with latest watchexec? It should sigterm, print |
It's with 1.24.2, which is what |
Can you provide a log? I can't replicate that |
Hmm, the log looks like it legitimately waited for the subprocess (see below). But in this test, bazel's final output definitely landed on the terminal after the shell wrote the prompt. (Only an instant after, but I can tell because the cursor is in the wrong place.) I guess it's possible that this is bazel's fault, maybe it has a background process running still that writes that final output. However, I don't see the same behavior when running bazel without watchexec -- in that case bazel's output finishes before the prompt is written. One thought: When you forward the signal to the child process, do you deliver it to the child's entire process group, or only to the direct child process? The shell would normally deliver to the whole group.
|
On unix it calls killpg(3) |
If you call with -vvvv does it provide more of a hint as to what's happening? Another thing might be that it runs with sh and bazel may behave better without (with |
just a note if someone else hits this: |
thanks for this, running |
I believe the root cause of this issue is described here: #743 (comment) |
watchexec v1.24.0 on Linux
Prior to this version, when I pressed ctrl+c, both watchexec and the program running under it would be termintaed.
As of 1.24, only watchexec is terminated. The inner program continues to run, including writing text to the terminal even though the shell has already presented me with a prompt.
If I use the new feature
--map-signal INT:INT
, then the problem is the opposite: ctrl+c interrupts the inner program, but does not terminate watchexec, and indeed it's unclear how watchexec can be terminated in this case without killing it from a separate terminal.I think the right default is for both watchexec and the inner program to be terminated on ctrl+c. This is normally what I want.
The text was updated successfully, but these errors were encountered: