Fix Ninja exit code when interrupted (issue #2681) - #2690
Merged
jhasse merged 1 commit intoNov 20, 2025
Merged
Conversation
This fixes #ninja-build#2681, a regression that was introduced during PR ninja-build#2540 where Ninja would return a status code of 0 when interrupted. The problem comes from RealCommandRunner::WaitForCommand() not updating the result->status field in case of interrupt being detected in Subprocess::DoWork(). This fixes the issue and adds a regression test for it. + Fix the CommandRunner::Result constructor to ensure that the `status` field is always initialized, even though it should now always be replaced at the end of a command.
digit-google
force-pushed
the
fix-status-code-when-ninja-is-interrupted
branch
from
November 6, 2025 13:40
f00d541 to
cc0b6ff
Compare
jtmorrisbytes
pushed a commit
to jtmorrisbytes/ninja-rs
that referenced
this pull request
May 4, 2026
…-when-ninja-is-interrupted Fix Ninja exit code when interrupted (issue ninja-build#2681)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes ##2681, a regression that was introduced during PR #2540 where Ninja would return a status code of 0 when interrupted.
The problem comes from RealCommandRunner::WaitForCommand() not updating the result->status field in case of interrupt being detected in Subprocess::DoWork().
This fixes the issue and adds a regression test for it.