File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
packages/pyodide-kernel/src Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -6,13 +6,13 @@ import { PromiseDelegate } from '@lumino/coreutils';
66
77import { PageConfig } from '@jupyterlab/coreutils' ;
88
9- import { ILogPayload } from '@jupyterlab/logconsole' ;
9+ import type { ILogPayload } from '@jupyterlab/logconsole' ;
1010
1111import { Contents , KernelMessage } from '@jupyterlab/services' ;
1212
1313import { BaseKernel , IKernel } from '@jupyterlite/kernel' ;
1414
15- import {
15+ import type {
1616 ICoincidentPyodideWorkerKernel ,
1717 IComlinkPyodideKernel ,
1818 IPyodideWorkerKernel ,
@@ -123,6 +123,7 @@ export class PyodideKernel extends BaseKernel implements IKernel {
123123 } ) ;
124124 }
125125 const remoteOptions = this . initRemoteOptions ( options ) ;
126+
126127 remote
127128 . initialize ( remoteOptions )
128129 . then ( this . _ready . resolve . bind ( this . _ready ) )
@@ -131,6 +132,7 @@ export class PyodideKernel extends BaseKernel implements IKernel {
131132 payload : { type : 'text' , level : 'critical' , data : err . message } ,
132133 kernelId : this . id ,
133134 } ) ;
135+ this . _ready . reject ( err . message ) ;
134136 } ) ;
135137 return remote ;
136138 }
@@ -168,6 +170,11 @@ export class PyodideKernel extends BaseKernel implements IKernel {
168170 if ( this . isDisposed ) {
169171 return ;
170172 }
173+ try {
174+ this . _ready . reject ( `${ this . id } was disposed` ) ;
175+ } catch ( err ) {
176+ // nothing to see here
177+ }
171178 this . _worker . terminate ( ) ;
172179 ( this . _worker as any ) = null ;
173180 super . dispose ( ) ;
You can’t perform that action at this time.
0 commit comments