Skip to content
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

ClosePseudoConsole hangs if the flags for CreatePseudoConsole aren't 0 #1

Open
TheLizzard opened this issue Apr 5, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@TheLizzard
Copy link
Owner

TheLizzard commented Apr 5, 2021

If the console is created width CreatePseudoConsole(..., dwFlags=1), the program hangs forever when we use ClosePseudoConsole. This must be linked with this microsoft bug.

@TheLizzard TheLizzard added the bug Something isn't working label Apr 5, 2021
@TheLizzard TheLizzard self-assigned this Apr 5, 2021
@TheLizzard TheLizzard changed the title CreatePseudoConsole hangs if the flags for CreatePseudoConsole aren't 0 ClosePseudoConsole hangs if the flags for CreatePseudoConsole aren't 0 Apr 5, 2021
@TheLizzard
Copy link
Owner Author

Problem is in _terminal.pseudoconsole.Console.close_console which calls _terminal._pseudoconsole.ClosePseudoConsole which is basically the window API call ClosePseudoConsole.

From the Windows API docs:
"A final painted frame may arrive on the hOutput handle originally provided to CreatePsuedoConsole when this API is called. It is expected that the caller will drain this information from the communication channel buffer and either present it or discard it. Failure to drain the buffer may cause the Close call to wait indefinitely until it is drained or the communication channels are broken another way."

@TheLizzard
Copy link
Owner Author

I have no idea what the "final painted frame" and the "communication channel buffer" are. Note we are closing all pipes+processes before calling ClosePseudoConsole.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant