1- use std:: borrow:: Borrow ;
21use std:: fmt:: Debug ;
32use std:: fmt:: Display ;
43use std:: process:: Child ;
@@ -234,8 +233,8 @@ impl ChildExt for ChildContext<Child> {
234233 E : From < Self :: Error > ,
235234 {
236235 self . log ( ) ?;
237- let command = dyn_clone :: clone_box ( self . command . borrow ( ) ) ;
238- match self . child . wait_with_output ( ) {
236+ let ( child , command) = self . into_child_and_command ( ) ;
237+ match child. wait_with_output ( ) {
239238 Ok ( output) => match output. try_into ( ) {
240239 Ok ( output) => succeeded ( OutputContext :: new ( output, command) ) ,
241240 Err ( error) => {
@@ -253,8 +252,8 @@ impl ChildExt for ChildContext<Child> {
253252 where
254253 E : From < Self :: Error > ,
255254 {
256- let command = dyn_clone :: clone_box ( self . command . borrow ( ) ) ;
257- match self . child . try_wait ( ) {
255+ let command = self . command_boxed ( ) . clone ( ) ;
256+ match self . child_mut ( ) . try_wait ( ) {
258257 Ok ( status) => succeeded ( TryWaitContext :: new ( status, command) ) ,
259258 Err ( inner) => Err ( Error :: from ( WaitError :: new ( command, inner) ) . into ( ) ) ,
260259 }
@@ -268,8 +267,8 @@ impl ChildExt for ChildContext<Child> {
268267 E : From < Self :: Error > ,
269268 {
270269 self . log ( ) ?;
271- let command = dyn_clone :: clone_box ( self . command . borrow ( ) ) ;
272- match self . child . wait ( ) {
270+ let command = self . command_boxed ( ) . clone ( ) ;
271+ match self . child_mut ( ) . wait ( ) {
273272 Ok ( status) => succeeded ( OutputContext :: new ( status, command) ) ,
274273 Err ( inner) => Err ( Error :: from ( ExecError :: new ( command, inner) ) . into ( ) ) ,
275274 }
0 commit comments