mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Add set_inheritable for Windows Handles
This commit is contained in:
@@ -198,6 +198,18 @@ pub(crate) fn duplicate(
|
||||
})?;
|
||||
unsafe { Ok(Self::from_raw_handle(ret)) }
|
||||
}
|
||||
|
||||
/// Allow child processes to inherit the handle.
|
||||
pub(crate) fn set_inheritable(&self) -> io::Result<()> {
|
||||
cvt(unsafe {
|
||||
c::SetHandleInformation(
|
||||
self.as_raw_handle(),
|
||||
c::HANDLE_FLAG_INHERIT,
|
||||
c::HANDLE_FLAG_INHERIT,
|
||||
)
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<HandleOrInvalid> for OwnedHandle {
|
||||
|
||||
@@ -221,6 +221,10 @@ pub fn duplicate(
|
||||
Ok(Self(self.0.duplicate(access, inherit, options)?))
|
||||
}
|
||||
|
||||
pub(crate) fn set_inheritable(&self) -> io::Result<()> {
|
||||
self.0.set_inheritable()
|
||||
}
|
||||
|
||||
/// Performs a synchronous read.
|
||||
///
|
||||
/// If the handle is opened for asynchronous I/O then this abort the process.
|
||||
|
||||
Reference in New Issue
Block a user