Skip to content

Report a proper exit code when Bazel is terminated by signal and use exec on Unix in the case of bazelisk run#757

Merged
fweikert merged 2 commits intobazelbuild:masterfrom
valco1994:termination_by_signal
Jan 15, 2026
Merged

Report a proper exit code when Bazel is terminated by signal and use exec on Unix in the case of bazelisk run#757
fweikert merged 2 commits intobazelbuild:masterfrom
valco1994:termination_by_signal

Conversation

@valco1994
Copy link
Contributor

It fixes issues #512 and #556

@valco1994
Copy link
Contributor Author

@fweikert, could you please take a look at it?

@fweikert fweikert self-requested a review January 15, 2026 20:31
@fweikert fweikert merged commit 166e156 into bazelbuild:master Jan 15, 2026
2 checks passed
@valco1994 valco1994 deleted the termination_by_signal branch January 15, 2026 23:20
@aaron-skydio
Copy link

@valco1994 why only exec when we find a run in the arg list (presumably indicating you're doing bazel run ...)? Why not exec always like I did in #566 (except when bazelisk itself has more work to do after)?

This seems especially confusing if I'm reading correctly and this will exec if you do like bazel --config run build or something, which is totally valid I think (equivalent to bazel --config=run build)

@valco1994
Copy link
Contributor Author

@aaron-skydio, I missed your pull request, and found it only when my pull request was already merged. So, I didn't consider making exec as often as possible, as was proposed by you in #566.

Considering the motivation, I wanted to fix issues reported by users - #512 and #556 - and in both cases, problematic scenarios were related to bazelisk run. Also, bazelisk is supposed to be a transparent wrapper around Bazel, and Bazel uses exec in the case of bazel run. It was impossible to rely on this behaviour before, when bazelisk was used, and it's possible now after my changes.

I have nothing against using exec more broadly, but probably it's worth thinking about scenarios which it can improve. Because we can't use exec always and must support both approaches anyway.

@aaron-skydio
Copy link

Yeah, I think the best (and easiest) way to be a transparent wrapper in general is with exec, regardless of whether bazel then again calls exec on a binary it's built or not. Agree it's most important/noticeable with bazel run though, and I think all of the issues we've hit related to this are with bazel run? Although regular behavior of bazel itself (e.g. during a build) on SIGQUIT is also weird when bazelisk is in the way and doesn't exec

@valco1994
Copy link
Contributor Author

Your reasoning is really well-founded, and an example with --config run is very representative. I like the idea and would be glad if it was implemented.

But I'm not a maintainer of this project, just a regular contributor.

@fweikert, what do you think about the idea of @aaron-skydio?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants