"tac" and "cat" commands now can return 1 status if sometthing is wrong.
This commit is contained in:
parent
0924a0dfbe
commit
4e41cf7aa6
2 changed files with 4 additions and 0 deletions
|
@ -39,11 +39,13 @@ func Run(args []string) int {
|
||||||
args = args[1:]
|
args = args[1:]
|
||||||
flagSet := flag.NewFlagSet(arg0, flag.ExitOnError)
|
flagSet := flag.NewFlagSet(arg0, flag.ExitOnError)
|
||||||
flagSet.Parse(args)
|
flagSet.Parse(args)
|
||||||
|
args = flagSet.Args()
|
||||||
if len(args)>0 {
|
if len(args)>0 {
|
||||||
for _, p := range args {
|
for _, p := range args {
|
||||||
e := cat(p)
|
e := cat(p)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
fmt.Fprintf(os.Stderr, "%s: %s.\n", arg0, e)
|
fmt.Fprintf(os.Stderr, "%s: %s.\n", arg0, e)
|
||||||
|
status = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -53,11 +53,13 @@ func Run(args []string) int {
|
||||||
args = args[1:]
|
args = args[1:]
|
||||||
flagSet := flag.NewFlagSet(arg0, flag.ExitOnError)
|
flagSet := flag.NewFlagSet(arg0, flag.ExitOnError)
|
||||||
flagSet.Parse(args)
|
flagSet.Parse(args)
|
||||||
|
args = flagSet.Args()
|
||||||
if len(args)>0 {
|
if len(args)>0 {
|
||||||
for _, p := range args {
|
for _, p := range args {
|
||||||
e := tac(p)
|
e := tac(p)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
fmt.Fprintf(os.Stderr, "%s: %s.\n", arg0, e)
|
fmt.Fprintf(os.Stderr, "%s: %s.\n", arg0, e)
|
||||||
|
status = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue