fix: 🐛 force kill old server with taskkill on windows

This commit is contained in:
Nate Sesti 2023-08-25 18:22:16 -07:00
parent 0757bd2b55
commit b1b7d13dbf
2 changed files with 20 additions and 1 deletions

View file

@ -247,7 +247,7 @@ function GUI(props: GUIProps) {
"mainTextEntryCounter",
(currentCount + 1).toString()
);
if (currentCount === 25) {
if (currentCount === 40) {
dispatch(
setDialogMessage(
<div className="text-center">

View file

@ -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())) {