mirror of
https://github.com/anchore/syft.git
synced 2026-10-31 14:36:33 +01:00
Disable ETUI for piped input (#571)
* fixed piped input Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * allow pipedinput helper to raise an error Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * factor out verbosity check to function Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
// IsPipedInput returns true if there is no input device, which means the user **may** be providing input via a pipe.
|
||||
func IsPipedInput() (bool, error) {
|
||||
fi, err := os.Stdin.Stat()
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("unable to determine if there is piped input: %w", err)
|
||||
}
|
||||
|
||||
return fi.Mode()&os.ModeCharDevice == 0, nil
|
||||
}
|
||||
Reference in New Issue
Block a user