Skip to content

Commit

Permalink
Handle cell execution cancellation because the notebook is being disp…
Browse files Browse the repository at this point in the history
…osed

Fixes jupyterlab#7554
  • Loading branch information
jasongrout committed Nov 22, 2019
1 parent b91f38f commit c8ca46c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/apputils/src/clientsession.tsx
Expand Up @@ -765,7 +765,7 @@ export class ClientSession implements IClientSession {
// If we have already, and now we aren't busy, dispose
// of the busy disposable.
if (this._setBusy) {
if (this.session.kernel && this.session.kernel.status === 'busy') {
if (status === 'busy') {
if (!this._busyDisposable) {
this._busyDisposable = this._setBusy();
}
Expand Down
5 changes: 3 additions & 2 deletions packages/cells/src/widget.ts
Expand Up @@ -1108,8 +1108,9 @@ export namespace CodeCell {
}
return msg;
} catch (e) {
// If this is still the current execution, clear the prompt.
if (e.message === 'Canceled' && cell.outputArea.future === future) {
// If we started executing, and the cell is still indicating this
// execution, clear the prompt.
if (future && !cell.isDisposed && cell.outputArea.future === future) {
cell.setPrompt('');
}
throw e;
Expand Down
7 changes: 3 additions & 4 deletions packages/notebook/src/actions.tsx
Expand Up @@ -1555,11 +1555,10 @@ namespace Private {
}
})
.catch(reason => {
if (reason.message !== 'Canceled') {
throw reason;
if (cell.isDisposed || reason.message.startsWith('Canceled')) {
return false;
}

return false;
throw reason;
})
.then(ran => {
if (ran) {
Expand Down

0 comments on commit c8ca46c

Please sign in to comment.