Updated command.go to use App handleExitCoder
This commit is contained in:
parent
ceee6408d5
commit
9d61cbad02
@ -167,7 +167,7 @@ func (c Command) Run(ctx *Context) (err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
if c.OnUsageError != nil {
|
if c.OnUsageError != nil {
|
||||||
err := c.OnUsageError(context, err, false)
|
err := c.OnUsageError(context, err, false)
|
||||||
HandleExitCoder(err)
|
context.App.handleExitCoder(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintln(context.App.Writer, "Incorrect Usage:", err.Error())
|
fmt.Fprintln(context.App.Writer, "Incorrect Usage:", err.Error())
|
||||||
@ -184,7 +184,7 @@ func (c Command) Run(ctx *Context) (err error) {
|
|||||||
defer func() {
|
defer func() {
|
||||||
afterErr := c.After(context)
|
afterErr := c.After(context)
|
||||||
if afterErr != nil {
|
if afterErr != nil {
|
||||||
HandleExitCoder(err)
|
ctx.App.handleExitCoder(err)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = NewMultiError(err, afterErr)
|
err = NewMultiError(err, afterErr)
|
||||||
} else {
|
} else {
|
||||||
@ -198,7 +198,7 @@ func (c Command) Run(ctx *Context) (err error) {
|
|||||||
err = c.Before(context)
|
err = c.Before(context)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ShowCommandHelp(context, c.Name)
|
ShowCommandHelp(context, c.Name)
|
||||||
HandleExitCoder(err)
|
context.App.handleExitCoder(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ func (c Command) Run(ctx *Context) (err error) {
|
|||||||
err = HandleAction(c.Action, context)
|
err = HandleAction(c.Action, context)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
HandleExitCoder(err)
|
ctx.App.handleExitCoder(err)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user