File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -176,11 +176,12 @@ impl HookPaths {
176176 . stderr ( std:: process:: Stdio :: piped ( ) )
177177 . spawn ( ) ?;
178178
179- if let Some ( input ) = stdin {
179+ if let Some ( mut stdin_handle ) = child . stdin . take ( ) {
180180 use std:: io:: Write ;
181- if let Some ( mut stdin_handle ) = child . stdin . take ( ) {
181+ if let Some ( input ) = stdin {
182182 stdin_handle. write_all ( input) ?;
183183 }
184+ drop ( stdin_handle) ;
184185 }
185186
186187 child. wait_with_output ( )
Original file line number Diff line number Diff line change @@ -26,12 +26,15 @@ fn exec_copy_with_args(
2626 . spawn ( )
2727 . map_err ( |e| anyhow ! ( "`{command:?}`: {e:?}" ) ) ?;
2828
29- process
29+ let mut stdin = process
3030 . stdin
31- . as_mut ( )
32- . ok_or_else ( || anyhow ! ( "`{command:?}`" ) ) ?
31+ . take ( )
32+ . ok_or_else ( || anyhow ! ( "`{command:?}`" ) ) ?;
33+
34+ stdin
3335 . write_all ( text. as_bytes ( ) )
3436 . map_err ( |e| anyhow ! ( "`{command:?}`: {e:?}" ) ) ?;
37+ drop ( stdin) ;
3538
3639 let out = process
3740 . wait_with_output ( )
You can’t perform that action at this time.
0 commit comments