File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
library/std/src/sys/unix/process Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ pub struct Command {
80
80
stdout : Option < Stdio > ,
81
81
stderr : Option < Stdio > ,
82
82
#[ cfg( target_os = "linux" ) ]
83
- pub ( crate ) create_pidfd : bool ,
83
+ create_pidfd : bool ,
84
84
}
85
85
86
86
// Create a new type for argv, so that we can make it `Send` and `Sync`
@@ -207,6 +207,17 @@ impl Command {
207
207
self . create_pidfd = val;
208
208
}
209
209
210
+ #[ cfg( not( target_os = "linux" ) ) ]
211
+ #[ allow( dead_code) ]
212
+ pub fn get_create_pidfd ( & self ) -> bool {
213
+ false
214
+ }
215
+
216
+ #[ cfg( target_os = "linux" ) ]
217
+ pub fn get_create_pidfd ( & self ) -> bool {
218
+ self . create_pidfd
219
+ }
220
+
210
221
pub fn saw_nul ( & self ) -> bool {
211
222
self . saw_nul
212
223
}
Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ impl Command {
162
162
// we will fall through this block to a call to `fork()`
163
163
if HAS_CLONE3 . load ( Ordering :: Relaxed ) {
164
164
let mut flags = 0 ;
165
- if self . create_pidfd {
165
+ if self . get_create_pidfd ( ) {
166
166
flags |= CLONE_PIDFD ;
167
167
}
168
168
@@ -387,7 +387,7 @@ impl Command {
387
387
|| ( self . env_saw_path ( ) && !self . program_is_path ( ) )
388
388
|| !self . get_closures ( ) . is_empty ( )
389
389
|| self . get_groups ( ) . is_some ( )
390
- || self . create_pidfd
390
+ || self . get_create_pidfd ( )
391
391
{
392
392
return Ok ( None ) ;
393
393
}
You can’t perform that action at this time.
0 commit comments