"tac" and "cat" commands now can return 1 status if sometthing is wrong.

This commit is contained in:
jienfak 2020-03-07 15:22:45 +05:00
parent 0924a0dfbe
commit 4e41cf7aa6
2 changed files with 4 additions and 0 deletions

View file

@ -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 {

View file

@ -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 {