Merge pull request #1117 from creekorful/harmonize-error-handling

Harmonize BeforeError handling
main
Robert Liebowitz 4 years ago committed by GitHub
commit 464c868816
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -292,8 +292,6 @@ func (a *App) RunContext(ctx context.Context, 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)
a.handleExitCoder(context, beforeErr)
err = beforeErr
return err

@ -150,7 +150,6 @@ func (c *Command) Run(ctx *Context) (err error) {
if c.Before != nil {
err = c.Before(context)
if err != nil {
_ = ShowCommandHelp(context, c.Name)
context.App.handleExitCoder(context, err)
return err
}

Loading…
Cancel
Save