@@ -381,29 +381,40 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
381
381
}
382
382
383
383
if ( this . _notebook && ! this . restartingKernel ) {
384
- if ( await this . shouldAskForRestart ( ) ) {
385
- // Ask the user if they want us to restart or not.
386
- const message = localize . DataScience . restartKernelMessage ( ) ;
387
- const yes = localize . DataScience . restartKernelMessageYes ( ) ;
388
- const dontAskAgain = localize . DataScience . restartKernelMessageDontAskAgain ( ) ;
389
- const no = localize . DataScience . restartKernelMessageNo ( ) ;
390
-
391
- const v = await this . applicationShell . showInformationMessage ( message , yes , dontAskAgain , no ) ;
392
- if ( v === dontAskAgain ) {
393
- await this . disableAskForRestart ( ) ;
394
- await this . restartKernelInternal ( ) ;
395
- } else if ( v === yes ) {
384
+ this . restartingKernel = true ;
385
+ this . startProgress ( ) ;
386
+
387
+ try {
388
+ if ( await this . shouldAskForRestart ( ) ) {
389
+ // Ask the user if they want us to restart or not.
390
+ const message = localize . DataScience . restartKernelMessage ( ) ;
391
+ const yes = localize . DataScience . restartKernelMessageYes ( ) ;
392
+ const dontAskAgain = localize . DataScience . restartKernelMessageDontAskAgain ( ) ;
393
+ const no = localize . DataScience . restartKernelMessageNo ( ) ;
394
+
395
+ const v = await this . applicationShell . showInformationMessage ( message , yes , dontAskAgain , no ) ;
396
+ if ( v === dontAskAgain ) {
397
+ await this . disableAskForRestart ( ) ;
398
+ await this . restartKernelInternal ( ) ;
399
+ } else if ( v === yes ) {
400
+ await this . restartKernelInternal ( ) ;
401
+ }
402
+ } else {
396
403
await this . restartKernelInternal ( ) ;
397
404
}
398
- } else {
399
- await this . restartKernelInternal ( ) ;
405
+ } finally {
406
+ this . restartingKernel = false ;
407
+ this . stopProgress ( ) ;
400
408
}
401
409
}
402
410
}
403
411
404
412
@captureTelemetry ( Telemetry . Interrupt )
405
413
public async interruptKernel ( ) : Promise < void > {
406
414
if ( this . _notebook && ! this . restartingKernel ) {
415
+ this . restartingKernel = true ;
416
+ this . startProgress ( ) ;
417
+
407
418
const status = this . statusProvider . set (
408
419
localize . DataScience . interruptKernelStatus ( ) ,
409
420
true ,
@@ -412,10 +423,10 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
412
423
this
413
424
) ;
414
425
415
- const settings = this . configuration . getSettings ( await this . getOwningResource ( ) ) ;
416
- const interruptTimeout = settings . datascience . jupyterInterruptTimeout ;
417
-
418
426
try {
427
+ const settings = this . configuration . getSettings ( await this . getOwningResource ( ) ) ;
428
+ const interruptTimeout = settings . datascience . jupyterInterruptTimeout ;
429
+
419
430
const result = await this . _notebook . interruptKernel ( interruptTimeout ) ;
420
431
status . dispose ( ) ;
421
432
@@ -436,6 +447,9 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
436
447
status . dispose ( ) ;
437
448
traceError ( err ) ;
438
449
this . applicationShell . showErrorMessage ( err ) ;
450
+ } finally {
451
+ this . restartingKernel = false ;
452
+ this . stopProgress ( ) ;
439
453
}
440
454
}
441
455
}
0 commit comments