File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import (
29
29
)
30
30
31
31
const PrintoutCanceledButRunningNormally string = "printout canceled but running normally"
32
+ const PrintoutTimeoutButRunningNormally string = "but running normally"
32
33
33
34
type JobProgressPrinter struct {
34
35
client clientv2.API
@@ -244,7 +245,7 @@ To cancel the job, run:
244
245
var returnError error = nil
245
246
246
247
// Capture Ctrl + C if the user wants to finish the job early
247
- ctx , cancel := context .WithCancel (ctx )
248
+ ctx , cancel := context .WithTimeout (ctx , 1 * time . Minute )
248
249
signalChan := make (chan os.Signal , 2 )
249
250
signal .Notify (signalChan , util .ShutdownSignals ... )
250
251
defer func () {
@@ -280,8 +281,17 @@ To cancel the job, run:
280
281
}
281
282
cancel ()
282
283
case <- ctx .Done ():
283
- return
284
+ cmdShuttingDown = true
285
+ cmd .SetOut (os .Stdout )
286
+
287
+ if ! quiet {
288
+ cmd .Println ("\n \n \r Printout canceled due to timeout (the job is still running)." )
289
+ cmd .Println (getMoreInfoString )
290
+ cmd .Println (cancelString )
291
+ }
292
+ returnError = fmt .Errorf ("%s" , PrintoutCanceledButRunningNormally )
284
293
}
294
+ return
285
295
}
286
296
}()
287
297
You can’t perform that action at this time.
0 commit comments