File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -238,19 +238,17 @@ func (c *runCommand) execute(_ *cobra.Command, args []string) {
238238 needTrackResources := logutils .IsVerbose () || c .opts .PrintResourcesUsage
239239
240240 trackResourcesEndCh := make (chan struct {})
241- defer func () { // XXX: this defer must be before ctx.cancel defer
241+ defer func () { // XXX: this defer must be before ctx.cancel defer
242242 if needTrackResources { // wait until resource tracking finished to print properly
243243 <- trackResourcesEndCh
244244 }
245245 }()
246246
247- var ctx context.Context
247+ ctx := context .Background ()
248248 if c .cfg .Run .Timeout > 0 {
249249 var cancel context.CancelFunc
250- ctx , cancel = context .WithTimeout (context . Background () , c .cfg .Run .Timeout )
250+ ctx , cancel = context .WithTimeout (ctx , c .cfg .Run .Timeout )
251251 defer cancel ()
252- } else {
253- ctx = context .Background ()
254252 }
255253
256254 if needTrackResources {
You can’t perform that action at this time.
0 commit comments