diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-08-25 18:22:16 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-08-25 18:22:16 -0700 |
commit | b1b7d13dbf5b9f6ada28a5ef22ea6857d3b0bcb6 (patch) | |
tree | 9f6a52d14e140d997bd8a67f926a7886b55ebb18 /extension/src/activation | |
parent | 0757bd2b556996b9c434ac43e3e4a3b042ef5802 (diff) | |
download | sncontinue-b1b7d13dbf5b9f6ada28a5ef22ea6857d3b0bcb6.tar.gz sncontinue-b1b7d13dbf5b9f6ada28a5ef22ea6857d3b0bcb6.tar.bz2 sncontinue-b1b7d13dbf5b9f6ada28a5ef22ea6857d3b0bcb6.zip |
fix: :bug: force kill old server with taskkill on windows
Diffstat (limited to 'extension/src/activation')
-rw-r--r-- | extension/src/activation/environmentSetup.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index 23c0d7de..2067f0fb 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -101,6 +101,25 @@ async function checkOrKillRunningServer(serverUrl: string): Promise<boolean> { } catch (e: any) { if (!e.message.includes("Process doesn't exist")) { console.log("Failed to kill old server:", e); + + // Try again, on Windows. This time with taskkill + if (os.platform() === "win32") { + try { + const exePath = path.join( + getExtensionUri().fsPath, + "server", + "exe", + "run.exe" + ); + + await runCommand(`taskkill /F /IM ${exePath}`); + } catch (e: any) { + console.log( + "Failed to kill old server second time on windows with taskkill:", + e + ); + } + } } } if (fs.existsSync(serverVersionPath())) { |