Do not double print errors from Before()
They should be handled by HandleExitCoder() as `After()` errors are.
This commit is contained in:
parent
f229e3c59c
commit
c64d74a5d9
1
app.go
1
app.go
@ -240,7 +240,6 @@ func (a *App) Run(arguments []string) (err error) {
|
||||
if a.Before != nil {
|
||||
beforeErr := a.Before(context)
|
||||
if beforeErr != nil {
|
||||
fmt.Fprintf(a.Writer, "%v\n\n", beforeErr)
|
||||
ShowAppHelp(context)
|
||||
HandleExitCoder(beforeErr)
|
||||
err = beforeErr
|
||||
|
@ -197,8 +197,6 @@ func (c Command) Run(ctx *Context) (err error) {
|
||||
if c.Before != nil {
|
||||
err = c.Before(context)
|
||||
if err != nil {
|
||||
fmt.Fprintln(context.App.Writer, err)
|
||||
fmt.Fprintln(context.App.Writer)
|
||||
ShowCommandHelp(context, c.Name)
|
||||
HandleExitCoder(err)
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user