Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion internal/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@ func IsPipedInput() (bool, error) {
return false, fmt.Errorf("unable to determine if there is piped input: %w", err)
}

return fi.Mode()&os.ModeCharDevice == 0, nil
// note: we should NOT use the absence of a character device here as the hint that there may be input expected
// on stdin, as running syft as a subprocess you would expect no character device to be present but input can
// be from either stdin or indicated by the CLI. Checking if stdin is a pipe is the most direct way to determine
// if there *may* be bytes that will show up on stdin that should be used for the analysis source.
return fi.Mode()&os.ModeNamedPipe != 0, nil
}