File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -804,11 +804,20 @@ fn run_ghook_with_dirs(
804804
805805 let mut child = command. spawn ( ) ?;
806806 if let Some ( mut child_stdin) = child. stdin . take ( ) {
807- child_stdin . write_all ( stdin. as_bytes ( ) ) ?;
807+ write_stdin_allow_broken_pipe ( & mut child_stdin , stdin. as_bytes ( ) ) ?;
808808 }
809809 Ok ( child. wait_with_output ( ) ?)
810810}
811811
812+ fn write_stdin_allow_broken_pipe ( stdin : & mut impl Write , bytes : & [ u8 ] ) -> io:: Result < ( ) > {
813+ // Invalid-arg paths can exit before stdin is read; CI can win that race.
814+ match stdin. write_all ( bytes) {
815+ Ok ( ( ) ) => Ok ( ( ) ) ,
816+ Err ( error) if error. kind ( ) == io:: ErrorKind :: BrokenPipe => Ok ( ( ) ) ,
817+ Err ( error) => Err ( error) ,
818+ }
819+ }
820+
812821fn assert_json_stdout ( output : & Output , expected : Value ) -> TestResult {
813822 let actual: Value = serde_json:: from_slice ( & output. stdout ) ?;
814823 assert_eq ! ( actual, expected) ;
You can’t perform that action at this time.
0 commit comments