Skip to content

Commit

Permalink
Correct check for parent context
Browse files Browse the repository at this point in the history
 - Comment states check parent, code checked child instead
 - No point performing parent check as code above ensures that this is never nil
  • Loading branch information
AtricoSoftware committed Oct 2, 2024
1 parent 78bfc83 commit 81a7781
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 81a7781

Please sign in to comment.