Skip to content

Commit 48bea23

Browse files
committed
adjust IsKilled for windows
1 parent f4f3ee6 commit 48bea23

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

exitstatus.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ type ExitStatus struct {
55
Code int
66
Signaled bool
77
typ exitType
8+
killed bool
89
}
910

1011
// IsTimedOut returns the command timed out or not
@@ -19,7 +20,7 @@ func (ex *ExitStatus) IsCanceled() bool {
1920

2021
// IsKilled returns the command is killed or not
2122
func (ex *ExitStatus) IsKilled() bool {
22-
return ex.Code == 137 && ex.Signaled
23+
return ex.killed
2324
}
2425

2526
// GetExitCode gets the exit code for command line tools

timeout.go

+1
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ func (tio *Timeout) handleTimeout(ctx context.Context) *ExitStatus {
153153
tio.killall()
154154
// just to make sure
155155
cmd.Process.Kill()
156+
ex.killed = true
156157
if ex.typ != exitTypeCanceled {
157158
ex.typ = exitTypeKilled
158159
}

0 commit comments

Comments
 (0)