@@ -73,35 +73,53 @@ impl InterruptablePid for tokio::process::Child {
7373}
7474
7575/// Create a new interruptable command
76- #[ cfg( unix) ]
7776pub fn new_command < S : AsRef < OsStr > > ( program : S ) -> Command {
78- Command :: new ( program)
77+ inner :: new_command ( program)
7978}
8079
81- /// Create a new interruptable command
82- #[ cfg( windows) ]
83- pub fn new_command < S : AsRef < OsStr > > ( program : S ) -> Command {
84- use std:: os:: windows:: process:: CommandExt as _;
80+ mod inner {
81+ use std:: { ffi:: OsStr , process:: Command } ;
8582
86- let mut command = Command :: new ( program) ;
87- command. creation_flags ( CREATE_NEW_PROCESS_GROUP ) ;
88- command
83+ #[ cfg( windows) ]
84+ pub fn new_command < S : AsRef < OsStr > > ( program : S ) -> Command {
85+ use std:: os:: windows:: process:: CommandExt as _;
86+
87+ let mut command = Command :: new ( program) ;
88+ command. creation_flags ( crate :: CREATE_NEW_PROCESS_GROUP ) ;
89+ command
90+ }
91+
92+ #[ cfg( unix) ]
93+ pub fn new_command < S : AsRef < OsStr > > ( program : S ) -> Command {
94+ use std:: process:: Command ;
95+
96+ Command :: new ( program)
97+ }
8998}
9099
91100/// Create a new interruptable tokio command
92101#[ cfg_attr( docsrs, doc( cfg( feature = "tokio" ) ) ) ]
93- #[ cfg( all ( feature = "tokio" , target_family = "windows" ) ) ]
102+ #[ cfg( feature = "tokio" ) ]
94103pub fn new_tokio_command < S : AsRef < OsStr > > ( program : S ) -> tokio:: process:: Command {
95- let mut command = tokio:: process:: Command :: new ( program) ;
96- command. creation_flags ( CREATE_NEW_PROCESS_GROUP ) ;
97- command
104+ inner_tokio:: new_tokio_command ( program)
98105}
99106
100- /// Create a new interruptable tokio command
101- #[ cfg_attr( docsrs, doc( cfg( feature = "tokio" ) ) ) ]
102- #[ cfg( all( feature = "tokio" , target_family = "unix" ) ) ]
103- pub fn new_tokio_command < S : AsRef < OsStr > > ( program : S ) -> tokio:: process:: Command {
104- tokio:: process:: Command :: new ( program)
107+ #[ cfg( feature = "tokio" ) ]
108+ mod inner_tokio {
109+ use std:: ffi:: OsStr ;
110+ use tokio:: process:: Command ;
111+
112+ #[ cfg( windows) ]
113+ pub fn new_tokio_command < S : AsRef < OsStr > > ( program : S ) -> Command {
114+ let mut command = Command :: new ( program) ;
115+ command. creation_flags ( crate :: CREATE_NEW_PROCESS_GROUP ) ;
116+ command
117+ }
118+
119+ #[ cfg( unix) ]
120+ pub fn new_tokio_command < S : AsRef < OsStr > > ( program : S ) -> Command {
121+ Command :: new ( program)
122+ }
105123}
106124
107125#[ cfg( test) ]
0 commit comments