Skip to content

Commit

Permalink
Fix command context not passed onto subcommands
Browse files Browse the repository at this point in the history
Fixes #1190
  • Loading branch information
hoshsadiq committed Feb 8, 2022
1 parent 2f702d2 commit 48decc4
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions command.go
Expand Up @@ -988,11 +988,7 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {
cmd.commandCalledAs.name = cmd.Name()
}

// We have to pass global context to children command
// if context is present on the parent command.
if cmd.ctx == nil {
cmd.ctx = c.ctx
}
cmd.ctx = c.ctx

err = cmd.execute(flags)
if err != nil {
Expand Down

0 comments on commit 48decc4

Please sign in to comment.