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

Reading from stdout of a process can hang on windows #975

Open
Aidan63 opened this issue Nov 17, 2021 · 0 comments
Open

Reading from stdout of a process can hang on windows #975

Aidan63 opened this issue Nov 17, 2021 · 0 comments

Comments

@Aidan63
Copy link
Contributor

Aidan63 commented Nov 17, 2021

Noticed that sometimes reading from the stdout of a process never returns on windows. Digging into things it seems like when the child process closes the stdout pipe isn't closed as it inherits from the parent process, so ReadFile will block forever as the child process has closed and there will never be more data in stdout.

I managed to work around this by setting HANDLE_FLAG_INHERIT to 0 using SetHandleInformation on the stdout pipe (https://stackoverflow.com/questions/54416116/readfile-does-not-return-while-reading-stdout-from-a-child-process-after-it-ends), but if I also apply that to the stderr pipe then reading from stdout will start to block again so I'm not sure what a proper fix would be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant