From 81a7781237b174d859cfebb2d9666b241eba57c1 Mon Sep 17 00:00:00 2001
From: "rob.rimmer" <developer@atrico.net>
Date: Tue, 1 Oct 2024 17:21:51 +0100
Subject: [PATCH] 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

---
 command.go | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/command.go b/command.go
index 2df6975f..03ef7983 100644
--- a/command.go
+++ b/command.go
@@ -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 {