Pass on null handle values to child process
This commit is contained in:
@@ -513,9 +513,6 @@ fn program_exists(path: &Path) -> Option<Vec<u16>> {
|
|||||||
impl Stdio {
|
impl Stdio {
|
||||||
fn to_handle(&self, stdio_id: c::DWORD, pipe: &mut Option<AnonPipe>) -> io::Result<Handle> {
|
fn to_handle(&self, stdio_id: c::DWORD, pipe: &mut Option<AnonPipe>) -> io::Result<Handle> {
|
||||||
match *self {
|
match *self {
|
||||||
// If no stdio handle is available, then inherit means that it
|
|
||||||
// should still be unavailable so propagate the
|
|
||||||
// INVALID_HANDLE_VALUE.
|
|
||||||
Stdio::Inherit => match stdio::get_handle(stdio_id) {
|
Stdio::Inherit => match stdio::get_handle(stdio_id) {
|
||||||
Ok(io) => unsafe {
|
Ok(io) => unsafe {
|
||||||
let io = Handle::from_raw_handle(io);
|
let io = Handle::from_raw_handle(io);
|
||||||
@@ -523,7 +520,8 @@ impl Stdio {
|
|||||||
io.into_raw_handle();
|
io.into_raw_handle();
|
||||||
ret
|
ret
|
||||||
},
|
},
|
||||||
Err(..) => unsafe { Ok(Handle::from_raw_handle(c::INVALID_HANDLE_VALUE)) },
|
// If no stdio handle is available, then propagate the null value.
|
||||||
|
Err(..) => unsafe { Ok(Handle::from_raw_handle(ptr::null_mut())) },
|
||||||
},
|
},
|
||||||
|
|
||||||
Stdio::MakePipe => {
|
Stdio::MakePipe => {
|
||||||
@@ -730,9 +728,9 @@ fn zeroed_startupinfo() -> c::STARTUPINFO {
|
|||||||
wShowWindow: 0,
|
wShowWindow: 0,
|
||||||
cbReserved2: 0,
|
cbReserved2: 0,
|
||||||
lpReserved2: ptr::null_mut(),
|
lpReserved2: ptr::null_mut(),
|
||||||
hStdInput: c::INVALID_HANDLE_VALUE,
|
hStdInput: ptr::null_mut(),
|
||||||
hStdOutput: c::INVALID_HANDLE_VALUE,
|
hStdOutput: ptr::null_mut(),
|
||||||
hStdError: c::INVALID_HANDLE_VALUE,
|
hStdError: ptr::null_mut(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user