diff --git a/electron/main.ts b/electron/main.ts index 22a5278b7d..3a2da0aca6 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 4f5ba2b4c5..27acbc8215 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