Pass context into handleExitCoder

This commit is contained in:
Tyler Davis
2017-06-28 09:52:12 -07:00
parent 9d61cbad02
commit 530df59178
3 changed files with 14 additions and 14 deletions

View File

@@ -167,7 +167,7 @@ func (c Command) Run(ctx *Context) (err error) {
if err != nil {
if c.OnUsageError != nil {
err := c.OnUsageError(context, err, false)
context.App.handleExitCoder(err)
context.App.handleExitCoder(context, err)
return err
}
fmt.Fprintln(context.App.Writer, "Incorrect Usage:", err.Error())
@@ -184,7 +184,7 @@ func (c Command) Run(ctx *Context) (err error) {
defer func() {
afterErr := c.After(context)
if afterErr != nil {
ctx.App.handleExitCoder(err)
context.App.handleExitCoder(context, err)
if err != nil {
err = NewMultiError(err, afterErr)
} else {
@@ -198,7 +198,7 @@ func (c Command) Run(ctx *Context) (err error) {
err = c.Before(context)
if err != nil {
ShowCommandHelp(context, c.Name)
context.App.handleExitCoder(err)
context.App.handleExitCoder(context, err)
return err
}
}
@@ -210,7 +210,7 @@ func (c Command) Run(ctx *Context) (err error) {
err = HandleAction(c.Action, context)
if err != nil {
ctx.App.handleExitCoder(err)
context.App.handleExitCoder(context, err)
}
return err
}