Skip to content

fix: reject on non-zero exit code regardless of stderr (Windows hang) - #13284

Open
avgon wants to merge 1 commit into
continuedev:mainfrom
avgon:fix/windows-terminal-hang
Open

avgon wants to merge 1 commit into
continuedev:mainfrom
avgon:fix/windows-terminal-hang

Conversation

@avgon

@avgon avgon commented Sep 16, 2026

Copy link
Copy Markdown

Summary

Fixes the intermittent test hang on windows-latest reported in #13273.

Root Cause

In runTerminalCommand.ts, the close handler only rejected the promise when both code !== 0 and stderr was non-empty:

s if (code !== 0 && stderr) { reject(...) }

On Windows, PowerShell's CommandNotFoundException can be flushed to stdout instead of stderr, or the stderr buffer may not be populated by the time the close event fires. When that happens the guard is false, the reject is skipped, and the promise is left permanently pending. The tool's own 180 s timeout (TIMEOUT_MS) cannot rescue it because vitest's 30 s testTimeout fires first.

Changes

  1. Reject on any non-zero exit code regardless of stderr content. Falls back to stdout or a generic message for diagnostics when stderr is empty.
  2. Add -NoProfile to the Windows PowerShell invocation to prevent slow/interfering profile scripts from delaying error output.

Testing

  • The existing should handle non-existent commands test now exercises the corrected path: PowerShell exits with code 1 and the promise rejects immediately whether the error lands in stderr or stdout.
  • All other tests in runTerminalCommand.test.ts are unaffected since successful commands still resolve normally.

Closes #13273

…ontinuedev#13273)

On Windows, PowerShell may flush CommandNotFoundException to stdout
instead of stderr, or the stderr buffer may not be populated by the
time the close event fires.  The previous guard `code !== 0 && stderr`
left the promise in a permanently pending state when stderr was empty,
causing vitest to hit its 30 s timeout before the tool's own 180 s
timeout could fire.

Changes:
- Reject on any non-zero exit code; fall back to stdout or a generic
  message for diagnostics when stderr is empty.
- Add -NoProfile to the Windows PowerShell invocation to prevent slow
  profile scripts from delaying or interfering with error output.

Closes continuedev#13273
@avgon
avgon requested a review from a team as a code owner September 16, 2026 09:14
@avgon
avgon requested review from sestinj and removed request for a team September 16, 2026 09:14
@github-actions

github-actions Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@avgon

avgon commented Sep 16, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

This branch has not been deployed

No deployments
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.

CLI: runTerminalCommand "should handle non-existent commands" intermittently hangs to vitest's 30s timeout on windows-latest

1 participant