File tree 1 file changed +13
-1
lines changed 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import (
12
12
"io"
13
13
"os"
14
14
"os/exec"
15
+ "runtime"
15
16
"strings"
16
17
"time"
17
18
@@ -344,7 +345,18 @@ func (c *Command) Run(opts *RunOpts) error {
344
345
log .Debug ("slow git.Command.Run: %s (%s)" , c , elapsed )
345
346
}
346
347
347
- if err != nil && ctx .Err () != context .DeadlineExceeded {
348
+ // We need to check if the context is canceled by the program on Windows.
349
+ // This is because Windows does not have signal checking when terminating the process.
350
+ // It always returns exit code 1, unlike Linux, which has many exit codes for signals.
351
+ if runtime .GOOS == "windows" &&
352
+ err != nil &&
353
+ err .Error () == "" &&
354
+ cmd .ProcessState .ExitCode () == 1 &&
355
+ ctx .Err () == context .Canceled {
356
+ return ctx .Err ()
357
+ }
358
+
359
+ if err != nil && ctx .Err () != context .DeadlineExceeded && ctx .Err () != context .Canceled {
348
360
return err
349
361
}
350
362
You can’t perform that action at this time.
0 commit comments