From 1439742544e031cf9de12eabf63fc25008ab00bc Mon Sep 17 00:00:00 2001 From: Louis <133622055+louis-jan@users.noreply.github.com> Date: Fri, 27 Oct 2023 16:46:18 +0700 Subject: [PATCH] chore: attempt to kill Nitro subprocesses (#484) --- electron/main.ts | 5 +++++ plugins/inference-plugin/index.ts | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/electron/main.ts b/electron/main.ts index 22a5278b7..3a2da0aca 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -43,6 +43,11 @@ app.on("window-all-closed", () => { app.quit(); }); +app.on("quit", () => { + dispose(requiredModules); + app.quit(); +}); + ipcMain.handle("setNativeThemeLight", () => { nativeTheme.themeSource = "light"; }); diff --git a/plugins/inference-plugin/index.ts b/plugins/inference-plugin/index.ts index 4f5ba2b4c..27acbc821 100644 --- a/plugins/inference-plugin/index.ts +++ b/plugins/inference-plugin/index.ts @@ -183,7 +183,14 @@ const registerListener = () => { events.on(EventName.OnNewMessageRequest, handleMessageRequest); }; +const killSubprocess = () => { + invokePluginFunc(MODULE_PATH, "killSubprocess"); +}; + const onStart = async () => { + // Try killing any existing subprocesses related to Nitro + killSubprocess(); + registerListener(); }; // Register all the above functions and objects with the relevant extension points