File tree 2 files changed +16
-0
lines changed
2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -198,6 +198,18 @@ impl OwnedHandle {
198
198
} ) ?;
199
199
unsafe { Ok ( Self :: from_raw_handle ( ret) ) }
200
200
}
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
+ }
201
213
}
202
214
203
215
impl TryFrom < HandleOrInvalid > for OwnedHandle {
Original file line number Diff line number Diff line change @@ -221,6 +221,10 @@ impl Handle {
221
221
Ok ( Self ( self . 0 . duplicate ( access, inherit, options) ?) )
222
222
}
223
223
224
+ pub ( crate ) fn set_inheritable ( & self ) -> io:: Result < ( ) > {
225
+ self . 0 . set_inheritable ( )
226
+ }
227
+
224
228
/// Performs a synchronous read.
225
229
///
226
230
/// 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