Skip to content

Commit f17a9c2

Browse files
authored
Ignore ERROR_NO_DATA on Windows in analyzer/processes.go (#312)
Tests sometimes fail in CI due to this error. Ignore it since it's no more interesting than ERROR_BROKEN_PIPE.
1 parent 5b809ad commit f17a9c2

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

analyzer/processes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func runProcesses(ctx context.Context, r io.Reader, confs ...Config) (*operation
4848
}
4949
// Broken pipe error is a result of a process shutting down. Return nil
5050
// here since the process errors are more interesting.
51-
if errors.Is(err, errPipe) {
51+
if isPipe(err) {
5252
err = nil
5353
}
5454
return err

analyzer/processes_notwindows.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
package analyzer
44

55
import (
6+
"errors"
67
"syscall"
78
)
89

9-
var errPipe = syscall.EPIPE
10+
func isPipe(err error) bool {
11+
return errors.Is(err, syscall.EPIPE)
12+
}

analyzer/processes_windows.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
package analyzer
22

33
import (
4+
"errors"
45
"syscall"
56
)
67

7-
var errPipe = syscall.ERROR_BROKEN_PIPE
8+
func isPipe(err error) bool {
9+
const ERROR_NO_DATA = syscall.Errno(232)
10+
return errors.Is(err, syscall.ERROR_BROKEN_PIPE) || errors.Is(err, ERROR_NO_DATA)
11+
}

0 commit comments

Comments
 (0)