Fix signal handling trap for xauth in Windows#843
Open
Tal500 wants to merge 3 commits intoPowerShell:latestw_allfrom
Open
Fix signal handling trap for xauth in Windows#843Tal500 wants to merge 3 commits intoPowerShell:latestw_allfrom
Tal500 wants to merge 3 commits intoPowerShell:latestw_allfrom
Conversation
Author
|
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
Pull request overview
Adjusts Windows X11 forwarding’s xauth invocation to avoid console/signal propagation issues by replacing system()/popen() usage with the existing subprocess() API.
Changes:
- Added a Windows-only helper to run
xauthviasubprocess()with consistent flags and optional stdout capture. - Replaced
system()call forxauth generatewith argument-vector +waitpid()handling on Windows. - Replaced
popen()call forxauth listwith stdout-capturing subprocess execution and output parsing on Windows.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Tal500
commented
Apr 27, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This fixes PowerShell/Win32-OpenSSH#1803. I'm sure that merging this PR will make the folks very happy, as this issue is very old even though the fix is easy.
I used codex for coding, but I verified and fixed its code.
By compiling (in Windows 11, x64, Release) this codebase both before my change and after, I have reproduced the bug before my change and verified that it fixed after the change.
More testing details - tested on windows terminal (
wt) under a with the shell of "Command Prompt", connected to this project SSH with the "-Y" flag, and the X11 server I used is VcXsrv.Technical Reasoning
Before
xauth was launched via
system/popen, making it accept the process signals from outside (such as sigint, i.e. Ctrl+C), interfearing with the Ctrl+C signal that the user wants to send to the actual running process in the terminal.After
Ensure xauth invocations on Windows use a consistent subprocess path and argument handling instead of
system/popen, avoiding console/signal issues and enabling proper stdout capture and exit-status checks.Description
client_x11_run_xauth_for_windowsthat launchesxauthvia the existingsubprocessAPI with consistent flags and optional stdout capture.system/popenusage inclient_x11_get_protowith argument-list based calls that use the new helper for bothgenerateandlistcode paths and parse captured output.