Skip to content

How do I close ConPty Std Input? #15006

Answered by lhecker
gerardog asked this question in Q&A
Discussion options

You must be logged in to vote

I've recently made a ton of improvements around the ConPTY shutdown behavior: #14544. The PR lists 4 additional PRs that are next to the "Depends on:" line. It should make shutdown much more robust when you close the stdin pipe of ConPTY.

It additionally adds a function called ConptyReleasePseudoConsole. If you call this on a HPCON you can then just read from stdout until the pipe gets closed on you, because that signals that the process you've spawned has exited. So there's no need to separately monitor the exit status of the process anymore.

The proper way to make the spawned process exit early is for you to drop the stdin pipe (= the pipe you write into) and (!) call ConptyClosePseudoC…

Replies: 11 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by lhecker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Product-Conpty For console issues specifically related to conpty
4 participants
Converted from issue

This discussion was converted from issue #11008 on March 16, 2023 21:50.