@@ -381,29 +381,40 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
381381 }
382382
383383 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 {
396403 await this . restartKernelInternal ( ) ;
397404 }
398- } else {
399- await this . restartKernelInternal ( ) ;
405+ } finally {
406+ this . restartingKernel = false ;
407+ this . stopProgress ( ) ;
400408 }
401409 }
402410 }
403411
404412 @captureTelemetry ( Telemetry . Interrupt )
405413 public async interruptKernel ( ) : Promise < void > {
406414 if ( this . _notebook && ! this . restartingKernel ) {
415+ this . restartingKernel = true ;
416+ this . startProgress ( ) ;
417+
407418 const status = this . statusProvider . set (
408419 localize . DataScience . interruptKernelStatus ( ) ,
409420 true ,
@@ -412,10 +423,10 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
412423 this
413424 ) ;
414425
415- const settings = this . configuration . getSettings ( await this . getOwningResource ( ) ) ;
416- const interruptTimeout = settings . datascience . jupyterInterruptTimeout ;
417-
418426 try {
427+ const settings = this . configuration . getSettings ( await this . getOwningResource ( ) ) ;
428+ const interruptTimeout = settings . datascience . jupyterInterruptTimeout ;
429+
419430 const result = await this . _notebook . interruptKernel ( interruptTimeout ) ;
420431 status . dispose ( ) ;
421432
@@ -436,6 +447,9 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
436447 status . dispose ( ) ;
437448 traceError ( err ) ;
438449 this . applicationShell . showErrorMessage ( err ) ;
450+ } finally {
451+ this . restartingKernel = false ;
452+ this . stopProgress ( ) ;
439453 }
440454 }
441455 }
0 commit comments