gemini-cli - 💡(How to fix) Fix WSL2 PTY Deadlock: Verifiable regression in inter-OS binary execution (Regression of #15233) [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25805Fetched 2026-04-23 07:45:02
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
closed ×1labeled ×1reopened ×1
RAW_BUFFERClick to expand / collapse

What happened?

Executing Windows binaries (e.g., pwsh.exe, cmd.exe) from within a WSL2 (Linux) environment via a PTY (the current default behavior in ShellExecutionService) results in process deadlocks or indefinite hangs. This is a known architectural limitation of WSL2's inter-process communication that has resurfaced in the current main branch.

What did you expect to happen?

The CLI should detect when a command pipeline contains Windows binaries while running on Linux/WSL and automatically bypass the PTY for stability, falling back to standard child_process execution. This ensures that cross-OS tool execution remains reliable.

Client information

Platform: WSL2 (Linux) Kernel: 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Version: 0.40.0-nightly.20260414.g5b1f7375a

Login information

N/A (Core execution logic issue)

Anything else we need to know?

This issue was previously tracked in #15233, which was closed as "inactive" on 2026-03-22. Testing on commit c47233a47 (current main) confirms that the deadlock is reproducible.

I have verified a fix that utilizes MZ magic byte detection in the shell pipeline to trigger an automatic PTY bypass. This fix has been tested and confirmed to resolve the hang without impacting native Linux execution.

I am happy to contribute a PR for this fix once the issue is reviewed and marked with the help-wanted label.

extent analysis

TL;DR

Detecting Windows binaries in the command pipeline and automatically bypassing PTY for those cases can resolve the process deadlocks or hangs when executing Windows binaries from WSL2.

Guidance

  • The issue is likely caused by WSL2's architectural limitation in inter-process communication when executing Windows binaries via PTY.
  • To verify the issue, try executing a Windows binary (e.g., pwsh.exe) from within a WSL2 environment and observe if the process deadlocks or hangs.
  • A potential fix involves detecting the MZ magic byte in the shell pipeline to trigger an automatic PTY bypass, which has been tested and confirmed to resolve the hang.
  • Before contributing a PR, ensure the issue is reviewed and marked with the help-wanted label.

Example

No code snippet is provided as the issue does not contain sufficient code details.

Notes

The provided fix utilizing MZ magic byte detection may have implications on native Linux execution, although the issue states it does not impact it. Further review and testing may be necessary to confirm this.

Recommendation

Apply the workaround by detecting Windows binaries and automatically bypassing PTY for those cases, as this has been tested and confirmed to resolve the issue without impacting native Linux execution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

gemini-cli - 💡(How to fix) Fix WSL2 PTY Deadlock: Verifiable regression in inter-OS binary execution (Regression of #15233) [1 participants]