Skip to content

Fix Ninja exit code when interrupted (issue #2681) - #2690

Merged
jhasse merged 1 commit into
ninja-build:masterfrom
digit-google:fix-status-code-when-ninja-is-interrupted
Nov 20, 2025
Merged

Fix Ninja exit code when interrupted (issue #2681)#2690
jhasse merged 1 commit into
ninja-build:masterfrom
digit-google:fix-status-code-when-ninja-is-interrupted

Conversation

@digit-google

Copy link
Copy Markdown
Contributor

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.

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
digit-google force-pushed the fix-status-code-when-ninja-is-interrupted branch from f00d541 to cc0b6ff Compare November 6, 2025 13:40
@jhasse
jhasse merged commit 231db65 into ninja-build:master Nov 20, 2025
17 checks passed
@digit-google
digit-google deleted the fix-status-code-when-ninja-is-interrupted branch February 20, 2026 14:03
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants