From 92d627205d1a2b7f1bac7ae477527126c2720dfd Mon Sep 17 00:00:00 2001 From: Mark G Date: Wed, 21 Feb 2024 11:07:49 -0500 Subject: [PATCH] Moving action check to top of function --- main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 69892d76..bde2d66a 100644 --- a/main.go +++ b/main.go @@ -154,15 +154,15 @@ func main() { // readFromStdin reads data piped into stdin func readFromStdin(opts *opts.CLIOptions) { + if opts.Global.XAction != "write" { + return + } + info, err := os.Stdin.Stat() if err != nil { logrus.Fatal(err) } - if opts.Global.XAction != "write" { - return - } - if info.Mode()&os.ModeCharDevice != 0 { return }