Skip to content

Commit 0a32d9f

Browse files
committed
review
1 parent b198df8 commit 0a32d9f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

pkg/commands/run.go

+3-5
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)