Skip to content

Commit bf925eb

Browse files
committed
Fix the issue with error message logging for the check-attr command on Windows OS.
1 parent 96e7369 commit bf925eb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

modules/git/command.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,10 @@ func (c *Command) run(ctx context.Context, skip int, opts *RunOpts) error {
350350
// We need to check if the context is canceled by the program on Windows.
351351
// This is because Windows does not have signal checking when terminating the process.
352352
// It always returns exit code 1, unlike Linux, which has many exit codes for signals.
353+
// `err.Error()` returns "exit status 1" when using the `git check-attr` command after the context is canceled.
353354
if runtime.GOOS == "windows" &&
354355
err != nil &&
355-
err.Error() == "" &&
356+
(err.Error() == "" || err.Error() == "exit status 1") &&
356357
cmd.ProcessState.ExitCode() == 1 &&
357358
ctx.Err() == context.Canceled {
358359
return ctx.Err()

0 commit comments

Comments
 (0)