Skip to content

Commit f39229e

Browse files
committed
fix: the context Done chan should be closed when using verbose mode
1 parent bf1ad2b commit f39229e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pkg/commands/run.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,14 @@ func (c *runCommand) execute(_ *cobra.Command, _ []string) {
246246
}
247247
}()
248248

249-
ctx := context.Background()
249+
ctx, cancel := context.WithCancel(context.Background())
250250
if c.cfg.Run.Timeout > 0 {
251-
var cancel context.CancelFunc
252251
ctx, cancel = context.WithTimeout(ctx, c.cfg.Run.Timeout)
253-
defer cancel()
254252
}
253+
defer cancel()
254+
255+
deadline, ok := ctx.Deadline()
256+
fmt.Println(deadline, ok)
255257

256258
if needTrackResources {
257259
go watchResources(ctx, trackResourcesEndCh, c.log, c.debugf)

0 commit comments

Comments
 (0)