Always return non-zero code from btcctl on error.

This commit is contained in:
Dave Collins 2013-10-22 10:01:13 -05:00
parent 629168b7ae
commit c55152ef7e

View file

@ -210,7 +210,6 @@ func usage(parser *flags.Parser) {
"\tgetrawmempool\n"+ "\tgetrawmempool\n"+
"\tgetrawtransaction <txhash> [verbose=0]\n"+ "\tgetrawtransaction <txhash> [verbose=0]\n"+
"\tstop\n") "\tstop\n")
os.Exit(1)
} }
func main() { func main() {
@ -224,7 +223,7 @@ func main() {
if e, ok := err.(*flags.Error); !ok || e.Type != flags.ErrHelp { if e, ok := err.(*flags.Error); !ok || e.Type != flags.ErrHelp {
usage(parser) usage(parser)
} }
return os.Exit(1)
} }
if cfg.Help { if cfg.Help {
usage(parser) usage(parser)
@ -236,7 +235,7 @@ func main() {
if !exists { if !exists {
fmt.Fprintf(os.Stderr, "Unrecognized command: %s\n", args[0]) fmt.Fprintf(os.Stderr, "Unrecognized command: %s\n", args[0])
usage(parser) usage(parser)
return os.Exit(1)
} }
// Execute the command. // Execute the command.
@ -244,9 +243,10 @@ func main() {
if err != nil { if err != nil {
if err == ErrUsage { if err == ErrUsage {
usage(parser) usage(parser)
return os.Exit(1)
} }
fmt.Fprintf(os.Stderr, "%v\n", err) fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
} }
} }