mirror of
https://github.com/spf13/cobra
synced 2024-11-24 14:47:12 +00:00
Correct check for parent context
- Comment states check parent, code checked child instead - No point performing parent check as code above ensures that this is never nil
This commit is contained in:
parent
78bfc837fe
commit
81a7781237
1 changed files with 2 additions and 5 deletions
|
@ -1109,11 +1109,8 @@ 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
|
||||
}
|
||||
// Copy context
|
||||
cmd.ctx = c.ctx
|
||||
|
||||
err = cmd.execute(flags)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue