Skip to content

Commit 96a3d44

Browse files
committed
Handle data from char device on stdin
1 parent 7473eb0 commit 96a3d44

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

v2/pkg/runner/options.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,15 @@ func ParseOptions() *Options {
145145
}
146146

147147
func hasStdin() bool {
148-
fi, err := os.Stdin.Stat()
148+
stat, err := os.Stdin.Stat()
149149
if err != nil {
150150
return false
151151
}
152152

153-
return fi.Mode()&os.ModeNamedPipe != 0
153+
isPipedFromChrDev := (stat.Mode() & os.ModeCharDevice) == 0
154+
isPipedFromFIFO := (stat.Mode() & os.ModeNamedPipe) != 0
155+
156+
return isPipedFromChrDev || isPipedFromFIFO
154157
}
155158

156159
func (options *Options) MergeFromConfig(configFileName string, ignoreError bool) {

0 commit comments

Comments
 (0)