Skip to content

Commit d0bdcbb

Browse files
author
Boshra Ariguib
committed
Closing window closes the pluto notebook. Still have to make sure this works in the packaged app. Related to #97
1 parent a69088e commit d0bdcbb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/main/pluto.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ class Pluto {
5050
});
5151

5252
this.win.once('close', async () => {
53+
// Shutdown the Pluto notebook when the window closes
54+
const url = new URL(this.win.webContents.getURL());
55+
const notebookId = url.searchParams.get('id');
56+
57+
if (notebookId) {
58+
generalLogger.info(`Shutting down notebook ${notebookId}`);
59+
await Pluto.notebook.shutdown(notebookId).catch((err) => {
60+
generalLogger.error('Error shutting down notebook:', err);
61+
});
62+
}
63+
5364
GlobalWindowManager.getInstance().unregisterWindow(this);
5465
});
5566

0 commit comments

Comments
 (0)