Merge pull request #885 from rhatdan/debug
Only print error message on kpod error not stacktrace
This commit is contained in:
commit
98ab11f460
1 changed files with 9 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/containers/storage/pkg/reexec"
|
||||
|
@ -13,6 +14,8 @@ import (
|
|||
var kpodVersion = ""
|
||||
|
||||
func main() {
|
||||
debug := false
|
||||
|
||||
if reexec.Init() {
|
||||
return
|
||||
}
|
||||
|
@ -52,6 +55,7 @@ func main() {
|
|||
app.Before = func(c *cli.Context) error {
|
||||
logrus.SetLevel(logrus.ErrorLevel)
|
||||
if c.GlobalBool("debug") {
|
||||
debug = true
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
}
|
||||
return nil
|
||||
|
@ -97,7 +101,11 @@ func main() {
|
|||
},
|
||||
}
|
||||
if err := app.Run(os.Args); err != nil {
|
||||
if debug {
|
||||
logrus.Errorf(err.Error())
|
||||
} else {
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
cli.OsExiter(1)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue