Skip to content

Commit 3b27686

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

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Diff for: pkg/commands/run.go

+6-4
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)
@@ -269,7 +271,7 @@ func (c *runCommand) execute(_ *cobra.Command, _ []string) {
269271
}
270272
}
271273

272-
c.setupExitCode(ctx)
274+
// c.setupExitCode(ctx)
273275
}
274276

275277
func (c *runCommand) startTracing() error {

0 commit comments

Comments
 (0)