fix use of SetHandleInformation on UWP
This commit is contained in:
parent
e1ec3260d7
commit
4f637ee30b
@ -206,6 +206,7 @@ impl OwnedHandle {
|
||||
}
|
||||
|
||||
/// Allow child processes to inherit the handle.
|
||||
#[cfg(not(target_vendor = "uwp"))]
|
||||
pub(crate) fn set_inheritable(&self) -> io::Result<()> {
|
||||
cvt(unsafe {
|
||||
c::SetHandleInformation(
|
||||
|
@ -10,6 +10,7 @@ use crate::mem;
|
||||
use crate::mem::forget;
|
||||
use crate::sys;
|
||||
use crate::sys::c;
|
||||
#[cfg(not(target_vendor = "uwp"))]
|
||||
use crate::sys::cvt;
|
||||
|
||||
/// A borrowed socket.
|
||||
|
@ -221,6 +221,7 @@ impl Handle {
|
||||
Ok(Self(self.0.duplicate(access, inherit, options)?))
|
||||
}
|
||||
|
||||
#[cfg(not(target_vendor = "uwp"))]
|
||||
pub(crate) fn set_inheritable(&self) -> io::Result<()> {
|
||||
self.0.set_inheritable()
|
||||
}
|
||||
|
@ -57,10 +57,21 @@ impl Pipes {
|
||||
} else {
|
||||
let (ours, theirs) = if ours_readable { (read, write) } else { (write, read) };
|
||||
let ours = Handle::from_raw_handle(ours);
|
||||
#[cfg(not(target_vendor = "uwp"))]
|
||||
let theirs = Handle::from_raw_handle(theirs);
|
||||
#[cfg(target_vendor = "uwp")]
|
||||
let mut theirs = Handle::from_raw_handle(theirs);
|
||||
|
||||
if their_handle_inheritable {
|
||||
theirs.set_inheritable()?;
|
||||
#[cfg(not(target_vendor = "uwp"))]
|
||||
{
|
||||
theirs.set_inheritable()?;
|
||||
}
|
||||
|
||||
#[cfg(target_vendor = "uwp")]
|
||||
{
|
||||
theirs = theirs.duplicate(0, true, c::DUPLICATE_SAME_ACCESS)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(Pipes { ours: AnonPipe::Sync(ours), theirs: AnonPipe::Sync(theirs) })
|
||||
|
Loading…
x
Reference in New Issue
Block a user