mirror of
https://github.com/anchore/grype
synced 2024-11-10 14:44:12 +00:00
f75889c694
* disable etui when piping input Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * restore jotframe version Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * remove test code Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * raise error from IsPipedInput Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * factor out verbosity check to function Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
16 lines
377 B
Go
16 lines
377 B
Go
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
|
|
}
|