File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -198,6 +198,18 @@ impl OwnedHandle {
198198 } ) ?;
199199 unsafe { Ok ( Self :: from_raw_handle ( ret) ) }
200200 }
201+
202+ /// Allow child processes to inherit the handle.
203+ pub ( crate ) fn set_inheritable ( & self ) -> io:: Result < ( ) > {
204+ cvt ( unsafe {
205+ c:: SetHandleInformation (
206+ self . as_raw_handle ( ) ,
207+ c:: HANDLE_FLAG_INHERIT ,
208+ c:: HANDLE_FLAG_INHERIT ,
209+ )
210+ } ) ?;
211+ Ok ( ( ) )
212+ }
201213}
202214
203215impl TryFrom < HandleOrInvalid > for OwnedHandle {
Original file line number Diff line number Diff line change @@ -221,6 +221,10 @@ impl Handle {
221221 Ok ( Self ( self . 0 . duplicate ( access, inherit, options) ?) )
222222 }
223223
224+ pub ( crate ) fn set_inheritable ( & self ) -> io:: Result < ( ) > {
225+ self . 0 . set_inheritable ( )
226+ }
227+
224228 /// Performs a synchronous read.
225229 ///
226230 /// If the handle is opened for asynchronous I/O then this abort the process.
You can’t perform that action at this time.
0 commit comments