File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -71,9 +71,17 @@ impl Command {
71
71
stderr. as_raw_fd_or_null_fd ( ) ?,
72
72
] ;
73
73
74
- for stdio in stdios {
75
- set_blocking ( stdio) . map_err ( Error :: ChildIo ) ?;
76
- }
74
+ let is_inherited = [
75
+ self . stdin_v . is_inherited ( ) ,
76
+ self . stdout_v . is_inherited ( ) ,
77
+ self . stderr_v . is_inherited ( ) ,
78
+ ] ;
79
+
80
+ stdios
81
+ . into_iter ( )
82
+ . zip ( is_inherited)
83
+ . filter_map ( |( stdio, is_inherited) | if !is_inherited { Some ( stdio) } else { None } )
84
+ . try_for_each ( |stdio| set_blocking ( stdio) . map_err ( Error :: ChildIo ) ) ?;
77
85
78
86
let cmd = NonZeroByteSlice :: new ( & self . cmd ) . ok_or ( Error :: InvalidCommand ) ?;
79
87
Original file line number Diff line number Diff line change @@ -43,6 +43,11 @@ impl Stdio {
43
43
pub const fn inherit ( ) -> Self {
44
44
Self ( StdioImpl :: Inherit )
45
45
}
46
+
47
+ #[ cfg( feature = "native-mux" ) ]
48
+ pub ( super ) fn is_inherited ( & self ) -> bool {
49
+ matches ! ( self . 0 , StdioImpl :: Inherit )
50
+ }
46
51
}
47
52
impl FromRawFd for Stdio {
48
53
unsafe fn from_raw_fd ( fd : RawFd ) -> Self {
You can’t perform that action at this time.
0 commit comments