File tree 1 file changed +24
-0
lines changed
library/std/src/sys/unix/process
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ pub struct Command {
79
79
stdin : Option < Stdio > ,
80
80
stdout : Option < Stdio > ,
81
81
stderr : Option < Stdio > ,
82
+ #[ cfg( target_os = "linux" ) ]
82
83
pub ( crate ) create_pidfd : bool ,
83
84
}
84
85
@@ -125,6 +126,28 @@ pub enum Stdio {
125
126
}
126
127
127
128
impl Command {
129
+ #[ cfg( not( target_os = "linux" ) ) ]
130
+ pub fn new ( program : & OsStr ) -> Command {
131
+ let mut saw_nul = false ;
132
+ let program = os2c ( program, & mut saw_nul) ;
133
+ Command {
134
+ argv : Argv ( vec ! [ program. as_ptr( ) , ptr:: null( ) ] ) ,
135
+ args : vec ! [ program. clone( ) ] ,
136
+ program,
137
+ env : Default :: default ( ) ,
138
+ cwd : None ,
139
+ uid : None ,
140
+ gid : None ,
141
+ saw_nul,
142
+ closures : Vec :: new ( ) ,
143
+ groups : None ,
144
+ stdin : None ,
145
+ stdout : None ,
146
+ stderr : None ,
147
+ }
148
+ }
149
+
150
+ #[ cfg( target_os = "linux" ) ]
128
151
pub fn new ( program : & OsStr ) -> Command {
129
152
let mut saw_nul = false ;
130
153
let program = os2c ( program, & mut saw_nul) ;
@@ -179,6 +202,7 @@ impl Command {
179
202
self . groups = Some ( Box :: from ( groups) ) ;
180
203
}
181
204
205
+ #[ cfg( target_os = "linux" ) ]
182
206
pub fn create_pidfd ( & mut self , val : bool ) {
183
207
self . create_pidfd = val;
184
208
}
You can’t perform that action at this time.
0 commit comments