From 4e41cf7aa6e33dba92d6d6a655aa80d9ba3339ab Mon Sep 17 00:00:00 2001 From: jienfak Date: Sat, 7 Mar 2020 15:22:45 +0500 Subject: [PATCH] "tac" and "cat" commands now can return 1 status if sometthing is wrong. --- cat/cat.go | 2 ++ tac/tac.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/cat/cat.go b/cat/cat.go index 78330e8..5a72933 100644 --- a/cat/cat.go +++ b/cat/cat.go @@ -39,11 +39,13 @@ func Run(args []string) int { args = args[1:] flagSet := flag.NewFlagSet(arg0, flag.ExitOnError) flagSet.Parse(args) + args = flagSet.Args() if len(args)>0 { for _, p := range args { e := cat(p) if e != nil { fmt.Fprintf(os.Stderr, "%s: %s.\n", arg0, e) + status = 1 } } } else { diff --git a/tac/tac.go b/tac/tac.go index d6efda1..d3f9012 100644 --- a/tac/tac.go +++ b/tac/tac.go @@ -53,11 +53,13 @@ func Run(args []string) int { args = args[1:] flagSet := flag.NewFlagSet(arg0, flag.ExitOnError) flagSet.Parse(args) + args = flagSet.Args() if len(args)>0 { for _, p := range args { e := tac(p) if e != nil { fmt.Fprintf(os.Stderr, "%s: %s.\n", arg0, e) + status = 1 } } } else {