-
Notifications
You must be signed in to change notification settings - Fork 362
Fix duplicate output on console resize event #806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…, and causes it to try again. xlink directvt/vtm#819 (comment) > When a window resize event is received (terminal generates WINDOW_BUFFER_SIZE_EVENT event when switching between alternate/normal buffer mode), the errno becomes EINTR which causes the write operation think its failed. potentially fixes PowerShell/Win32-OpenSSH#2275
|
@microsoft-github-policy-service agree |
… operation think its failed
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
This is infuriating. It's interrupting my entire workflow. Please make this a priority. |
|
All checks seem to be passing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a long-standing issue where console resize events caused duplicate output in Win32-OpenSSH. The root cause was that the SIGWINCH signal handler was setting errno = EINTR, which caused concurrent write operations to be incorrectly treated as failed and retried, resulting in duplicate console output and application requests.
Key changes:
- Modified signal processing to exclude
W32_SIGWINCHfrom settingerrno = EINTR, preventing false write operation failures - Removed the workaround code that attempted to consume the first
WINDOW_BUFFER_SIZE_EVENTafter entering raw mode
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| contrib/win32/win32compat/signal.c | Added W32_SIGWINCH to the exclusion list for signals that should not set errno = EINTR, preventing write operations from being incorrectly interrupted |
| contrib/win32/win32compat/console.c | Removed the workaround that consumed the first console resize event, as it's no longer needed with the signal handling fix |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tgauth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @o-sdn-o!
PR Summary
Fix the long-known issue of duplicate output.
PR Context
When a console resize event is received, the event handler sets
errnotoEINTR, which falsely causes a concurrently pending write operation to be considered failed and retried. This results in duplicate console output, as well as duplicate application requests. This duplication can lead to an infinite loop, since a duplicate request generates another console resize event, which triggers another duplicate request. This can occur, for example, when terminals generate a resize event when an application requests a switch between alternate/normal buffer mode.Fixes PowerShell/Win32-OpenSSH#2275 and most of related issues.
Related to:
watchcommand doesn't work properly microsoft/terminal#8869