If command.Execute() return err, print to stdErr

pull/6/head
netroby 2017-08-18 13:05:58 +08:00 committed by GitHub
parent a4f6ae4402
commit ac2729ed0a
1 changed files with 3 additions and 1 deletions

View File

@ -18,6 +18,7 @@ package main
import (
goflag "flag"
"fmt"
"os"
"github.com/spf13/pflag"
@ -41,7 +42,8 @@ func main() {
logs.InitLogs()
defer logs.FlushLogs()
if err := command.Execute(); err != nil {
if err := command.Execute(); err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
}
}