@@ -137,7 +137,7 @@ impl GroupCmds {
137137 }
138138 }
139139
140- pub fn spawn ( mut self ) -> Result < WaitCmd > {
140+ pub fn spawn ( mut self ) -> Result < CmdChildren > {
141141 assert_eq ! ( self . group_cmds. len( ) , 1 ) ;
142142 let mut cmds = self . group_cmds . pop ( ) . unwrap ( ) . 0 ;
143143 let ret = cmds. spawn ( & mut self . current_dir ) ;
@@ -146,18 +146,6 @@ impl GroupCmds {
146146 }
147147 ret
148148 }
149-
150- pub fn spawn_with_output ( mut self ) -> Result < WaitFun > {
151- assert_eq ! ( self . group_cmds. len( ) , 1 ) ;
152- let mut cmds = self . group_cmds . pop ( ) . unwrap ( ) . 0 ;
153- match cmds. spawn ( & mut self . current_dir ) {
154- Ok ( ret) => Ok ( WaitFun ( ret. 0 ) ) ,
155- Err ( err) => {
156- error ! ( "Spawning {} failed, Error: {}" , cmds. get_full_cmds( ) , err) ;
157- Err ( err)
158- }
159- }
160- }
161149}
162150
163151#[ doc( hidden) ]
@@ -181,7 +169,7 @@ impl Cmds {
181169 & self . full_cmds
182170 }
183171
184- fn spawn ( & mut self , current_dir : & mut String ) -> Result < WaitCmd > {
172+ fn spawn ( & mut self , current_dir : & mut String ) -> Result < CmdChildren > {
185173 if std:: env:: var ( "CMD_LIB_DEBUG" ) == Ok ( "1" . into ( ) ) {
186174 debug ! ( "Running {} ..." , self . get_full_cmds( ) ) ;
187175 }
@@ -204,22 +192,22 @@ impl Cmds {
204192 children. push ( child) ;
205193 }
206194
207- Ok ( WaitCmd ( children) )
195+ Ok ( CmdChildren ( children) )
208196 }
209197
210198 fn run_cmd ( & mut self , current_dir : & mut String ) -> CmdResult {
211- self . spawn ( current_dir) ?. wait_result_nolog ( )
199+ self . spawn ( current_dir) ?. wait_cmd_nolog ( )
212200 }
213201
214202 fn run_fun ( & mut self , current_dir : & mut String ) -> FunResult {
215- WaitFun ( self . spawn ( current_dir) ?. 0 ) . wait_result_nolog ( )
203+ self . spawn ( current_dir) ?. wait_fun_nolog ( )
216204 }
217205}
218206
219- pub struct WaitCmd ( Vec < CmdChild > ) ;
220- impl WaitCmd {
221- pub fn wait_result ( & mut self ) -> CmdResult {
222- let ret = self . wait_result_nolog ( ) ;
207+ pub struct CmdChildren ( Vec < CmdChild > ) ;
208+ impl CmdChildren {
209+ pub fn wait_cmd ( & mut self ) -> CmdResult {
210+ let ret = self . wait_cmd_nolog ( ) ;
223211 if let Err ( ref err) = ret {
224212 error ! (
225213 "Running {} failed, Error: {}" ,
@@ -230,7 +218,7 @@ impl WaitCmd {
230218 ret
231219 }
232220
233- fn wait_result_nolog ( & mut self ) -> CmdResult {
221+ fn wait_cmd_nolog ( & mut self ) -> CmdResult {
234222 // wait last process result
235223 let handle = self . 0 . pop ( ) . unwrap ( ) ;
236224 handle. wait ( true ) ?;
@@ -244,10 +232,7 @@ impl WaitCmd {
244232 }
245233 Ok ( ( ) )
246234 }
247- }
248235
249- pub struct WaitFun ( Vec < CmdChild > ) ;
250- impl WaitFun {
251236 pub fn wait_raw_result ( & mut self ) -> Result < Vec < u8 > > {
252237 let ret = self . wait_raw_result_nolog ( ) ;
253238 if let Err ( ref err) = ret {
@@ -265,18 +250,18 @@ impl WaitFun {
265250 let wait_last = handle. wait_with_output ( ) ;
266251 match wait_last {
267252 Err ( e) => {
268- let _ = WaitCmd :: wait_children ( & mut self . 0 ) ;
253+ let _ = Self :: wait_children ( & mut self . 0 ) ;
269254 Err ( e)
270255 }
271256 Ok ( output) => {
272- WaitCmd :: wait_children ( & mut self . 0 ) ?;
257+ Self :: wait_children ( & mut self . 0 ) ?;
273258 Ok ( output)
274259 }
275260 }
276261 }
277262
278- pub fn wait_result ( & mut self ) -> FunResult {
279- let ret = self . wait_result_nolog ( ) ;
263+ pub fn wait_fun ( & mut self ) -> FunResult {
264+ let ret = self . wait_fun_nolog ( ) ;
280265 if let Err ( ref err) = ret {
281266 error ! (
282267 "Running {} failed, Error: {}" ,
@@ -287,21 +272,21 @@ impl WaitFun {
287272 ret
288273 }
289274
290- fn wait_result_nolog ( & mut self ) -> FunResult {
275+ fn wait_fun_nolog ( & mut self ) -> FunResult {
291276 // wait last process result
292277 let handle = self . 0 . pop ( ) . unwrap ( ) ;
293278 let wait_last = handle. wait_with_output ( ) ;
294279 match wait_last {
295280 Err ( e) => {
296- let _ = WaitCmd :: wait_children ( & mut self . 0 ) ;
281+ let _ = CmdChildren :: wait_children ( & mut self . 0 ) ;
297282 Err ( e)
298283 }
299284 Ok ( output) => {
300285 let mut ret = String :: from_utf8_lossy ( & output) . to_string ( ) ;
301286 if ret. ends_with ( '\n' ) {
302287 ret. pop ( ) ;
303288 }
304- WaitCmd :: wait_children ( & mut self . 0 ) ?;
289+ CmdChildren :: wait_children ( & mut self . 0 ) ?;
305290 Ok ( ret)
306291 }
307292 }
0 commit comments