bazel-watcher icon indicating copy to clipboard operation
bazel-watcher copied to clipboard

Option to only require one SIGINT

Open jdarpinian opened this issue 9 months ago • 8 comments

Can you add a configuration option to have ibazel exit automatically when the subprocess exits?

jdarpinian avatar Apr 08 '25 01:04 jdarpinian

ibazel exit automatically when the subprocess exits

like a one-shot?

To simplify a bit far, I think the subprocesses to ibazel are bazel query and either bazel build or bazel run (there's a bit more complexity there).

ibazel remains running but triggers later bazel runs based on when it defects filesystem changes -- which you already know -- but I mention this to suggest that the cild process is complete with a successful exit while ibazel waits.

only require one SIGINT

This title might be different from how I understand your idea. Are you actually looking for ibazel to exit when the user SIGINTs the child that ibazel is running? (specific to SIGINT, not generally when the child process exits)

chickenandpork avatar Apr 11 '25 16:04 chickenandpork

My problem is that I have to press Ctrl-C twice to exit ibazel when I'm doing ibazel run with a persistent subprocess. I'd like to at least have an option to have one Ctrl-C exit ibazel.

jdarpinian avatar Apr 11 '25 18:04 jdarpinian

Hey @jdarpinian, just to explain the behavior. The first SIGINT (ctrl-c) is passed to the internal process. This is so that you if you do something like make an infinite for loop you can cancel it without bailing out of ibazel. Any subsequent SIGINT then will quit ibazel.

Can you add a configuration option to have ibazel exit automatically when the subprocess exits?

Isn't that what running normal bazel commands does? Maybe you can expand on your usecase here a bit

achew22 avatar Apr 17 '25 06:04 achew22

The normal bazel command doesn't automatically rebuild on file changes. The internal process is a web server which exits on Ctrl-C. Once it exits I have no need for ibazel to continue running.

jdarpinian avatar Apr 17 '25 14:04 jdarpinian

The normal bazel command doesn't automatically rebuild on file changes.

That sounds like an error. Can you share a link to a GitHub project, or a small repro?

chickenandpork avatar Apr 17 '25 14:04 chickenandpork

There is clearly some misunderstanding here. bazel run does not watch your source files for changes and automatically rebuild while your command is still running. It builds once per bazel run invocation and that's it. Watching source files for changes and automatically rebuilding while my command continues to run is the whole reason I want to use ibazel instead. I just don't want to have to press Ctrl-C twice to exit.

jdarpinian avatar Apr 17 '25 14:04 jdarpinian

@jdarpinian

There is clearly some misunderstanding here. bazel run does not watch your source files for changes and automatically rebuild while your command is still running. It builds once per bazel run invocation and that's it.

Sorry, I misread: I saw a ibazel there where you wrote bazel.

I honestly don't see the use-case, but I won't knock it without understanding. You're ultimately wanting Ctrl-C to act like a sigKill, stopping both clild process and parent ibazel.

That's a 1-line fix in ibazel.go@156, plus 4-6 lines of cli arg markup. A bunch of LoC for unittest. Sensible one-off feature, @achew22 ?

chickenandpork avatar Apr 17 '25 17:04 chickenandpork

Stale issue message

github-actions[bot] avatar Jun 17 '25 02:06 github-actions[bot]