File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,22 +109,28 @@ impl HookPaths {
109109 let hook = self . hook . clone ( ) ;
110110 log:: trace!( "run hook '{:?}' in '{:?}'" , hook, self . pwd) ;
111111
112- let mut command = if cfg ! ( windows) {
112+ let run_command = |mut command : Command | {
113+ command
114+ . args ( args)
115+ . current_dir ( & self . pwd )
116+ . with_no_window ( )
117+ . output ( )
118+ } ;
119+
120+ let output = if cfg ! ( windows) {
113121 // execute hook with sh
114- sh_command ( & hook)
122+ run_command ( sh_command ( & hook) )
115123 } else {
116124 // execute hook directly
117- Command :: new ( & hook)
118- } ;
119-
120- let output = command
121- . args ( args)
122- . current_dir ( & self . pwd )
123- . with_no_window ( )
124- . output ( ) ?;
125+ match run_command ( Command :: new ( & hook) ) {
126+ Err ( err) if err. raw_os_error ( ) == Some ( 8 ) => {
127+ run_command ( sh_command ( & hook) )
128+ }
129+ result => result,
130+ }
131+ } ?;
125132
126133 if output. status . success ( ) {
127- eprintln ! ( "{}" , String :: from_utf8_lossy( & output. stdout) ) ;
128134 Ok ( HookResult :: Ok { hook } )
129135 } else {
130136 let stderr =
You can’t perform that action at this time.
0 commit comments