Skip to content

Commit 81a7781

Browse files
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
1 parent 78bfc83 commit 81a7781

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

command.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -1109,11 +1109,8 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {
11091109
cmd.commandCalledAs.name = cmd.Name()
11101110
}
11111111

1112-
// We have to pass global context to children command
1113-
// if context is present on the parent command.
1114-
if cmd.ctx == nil {
1115-
cmd.ctx = c.ctx
1116-
}
1112+
// Copy context
1113+
cmd.ctx = c.ctx
11171114

11181115
err = cmd.execute(flags)
11191116
if err != nil {

0 commit comments

Comments
 (0)