Skip to content

fix(windows): terminal drain + cwd path conversion (salvage #19258)#21259

Merged
teknium1 merged 1 commit into
mainfrom
salvage/pr-19258
May 7, 2026
Merged

fix(windows): terminal drain + cwd path conversion (salvage #19258)#21259
teknium1 merged 1 commit into
mainfrom
salvage/pr-19258

Conversation

@teknium1

@teknium1 teknium1 commented May 7, 2026

Copy link
Copy Markdown
Contributor

Closes #19258 via salvage. Fixes #14638.

Summary

Two Windows-only local terminal bugs:

  1. _drain() in base.py uses select.select() which only works on sockets on Windows, not pipe fds. Switch to blocking os.read() in the daemon thread on nt.
  2. _run_bash() in local.py gets Git Bash paths (/c/Users/...) from pwd but subprocess.Popen(cwd=...) needs native Windows paths (C:\Users\...). Convert before Popen.

Without these, terminal() on Windows returns empty output with exit code 126 and cwd tracking breaks.

Improvements during salvage

Validation

scripts/run_tests.sh tests/tools/ -k 'environment or local' → 295 passed + 4 pre-existing failures unrelated to this change (daytona/vercel/browser tests already failing on main).

Original author: @alanxchen85.

Two fixes for the local terminal backend on Windows (Git Bash):

1. `_drain()` in base.py: `select.select()` only works on sockets on
   Windows, not pipe file descriptors. On Windows, use blocking
   `os.read()` in the daemon thread instead. EOF arrives promptly
   when bash exits, so this is safe.

2. `_run_bash()` in local.py: When `self.cwd` is updated from `pwd`
   output, it contains Git Bash-style paths (`/c/Users/...`).
   `subprocess.Popen(cwd=...)` needs a native Windows path
   (`C:\Users\...`). Added a conversion before Popen.

Without these fixes, all terminal() calls on Windows return empty
output (exit code 126), and cwd tracking breaks.

Tested on Windows 11 with Git for Windows + Python 3.13.

Fixes #14638
@teknium1 teknium1 merged commit c2d6b38 into main May 7, 2026
8 of 11 checks passed
@teknium1 teknium1 deleted the salvage/pr-19258 branch May 7, 2026 13:11
@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: salvage/pr-19258 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 7522 on HEAD, 7522 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 3950 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists backend/local Local shell execution comp/cli CLI entry point, hermes_cli/, setup wizard labels May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend/local Local shell execution comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: Terminal exits 126 with empty output on every command (Git Bash backend)

3 participants