This repository was archived by the owner on May 15, 2026. It is now read-only.
fix: correctly report exit codes from ExecaTerminalProcess - #11045
Draft
ghost wants to merge 1 commit into
Draft
Conversation
- Fix bug where ExecaTerminalProcess always emitted exitCode: 0 - After stream iteration, await subprocess to get actual exit code - Handle ExecaError thrown during await with exit code and signal - Add tests for non-zero exit code scenarios Fixes #11044
Author
Review completed. No issues found. The fix correctly addresses the bug where Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Related GitHub Issue
Closes: #11044
Description
This PR attempts to address Issue #11044 where Roo Code was not getting the correct return code from commands running in the VSCode terminal.
Root Cause: In
ExecaTerminalProcess.ts, after iterating over the subprocess output stream, the code always emittedexitCode: 0regardless of the actual exit code. The problem is that stream iteration completes successfully regardless of the exit code - the subprocess needs to be awaited separately to obtain the actual exit code.Solution: After the stream iteration completes, await the subprocess to get its result and emit the correct exit code. Handle edge cases where awaiting the subprocess might throw an
ExecaError.Key changes:
this.subprocessto get the actual exit codeExecaErrorthat may be thrown during the awaitTest Procedure
Added new tests in
ExecaTerminalProcess.spec.ts:All 15 tests pass:
Manual testing: Commands like
falseorexit 1should now report the correct non-zero exit code.Pre-Submission Checklist
Documentation Updates
Additional Notes
Feedback and guidance are welcome!
Important
Fixes exit code reporting in
ExecaTerminalProcessby awaiting subprocess and handlingExecaError.ExecaTerminalProcess.ts, awaitthis.subprocessafter stream iteration to get the correct exit code.ExecaErrorduring await to emit correct exit code and signal.ExecaTerminalProcess.spec.tsfor non-zero exit codes, specific exit codes,ExecaErrorhandling, and successful commands.exit 1,nonexistent_command, andecho success.This description was created by
for 97f0aca. You can customize this summary. It will automatically update as commits are pushed.