Skip to content

Failure to spawn on Windows if stdio handles are null #31167

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

Closed
alexcrichton opened this issue Jan 24, 2016 · 1 comment
Closed

Failure to spawn on Windows if stdio handles are null #31167

alexcrichton opened this issue Jan 24, 2016 · 1 comment
Labels
O-windows Operating system: Windows

Comments

@alexcrichton
Copy link
Member

As reported here, if one of the stdio handles for a Windows process is unset (e.g. isn't present) then you won't actually be able to spawn a process by default. All handles are set, by default, to "inherit", but this currently means duplicate the existing handle, which in turn means that if the stdio handle isn't present this operation will fail.

Rust currently defends against this by always opening up handles even if Stdio::null() is specified (just pointing them to a blank stream), but Rust should also defend against this situation when it was spawned from elsewhere.

@emoon
Copy link
Contributor

emoon commented Jan 25, 2016

cc @emoon

alexcrichton added a commit to alexcrichton/rust that referenced this issue Jan 26, 2016
On all platforms, reading from stdin where the actual stdin isn't present should
return 0 bytes as having been read rather than the entire buffer.

On Windows, handle the case where we're inheriting stdio handles but one of them
isn't present. Currently the behavior is to fail returning an I/O error but
instead this commit corrects it to detecting this situation and propagating the
non-set handle.

Closes rust-lang#31167
Manishearth added a commit to Manishearth/rust that referenced this issue Jan 26, 2016
On all platforms, reading from stdin where the actual stdin isn't present should
return 0 bytes as having been read rather than the entire buffer.

On Windows, handle the case where we're inheriting stdio handles but one of them
isn't present. Currently the behavior is to fail returning an I/O error but
instead this commit corrects it to detecting this situation and propagating the
non-set handle.

Closes rust-lang#31167
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-windows Operating system: Windows
Projects
None yet
Development

No branches or pull requests

2 participants