From b2b38fb8a8aed10c28a8aa4c7b5786ce837d0d4e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 28 Aug 2023 23:44:54 -0500 Subject: [PATCH] [Release] 2.3.6 --- frontend/src/.editorconfig => .editorconfig | 5 ++- CHANGELOG.md | 4 ++ app/core/server-process-manager.js | 41 ++++++++++++--------- package.json | 2 +- 4 files changed, 33 insertions(+), 19 deletions(-) rename frontend/src/.editorconfig => .editorconfig (87%) diff --git a/frontend/src/.editorconfig b/.editorconfig similarity index 87% rename from frontend/src/.editorconfig rename to .editorconfig index 4c18e7f..f9f7554 100644 --- a/frontend/src/.editorconfig +++ b/.editorconfig @@ -5,7 +5,7 @@ charset = utf-8 end_of_line = lf insert_final_newline = true indent_style = space -indent_size = 4 +indent_size = 2 trim_trailing_whitespace = true [*.md] @@ -14,6 +14,9 @@ trim_trailing_whitespace = false [*.{yml,yaml}] indent_size = 2 +[*.js] +indent_size = 2 + [*.ts] indent_size = 2 diff --git a/CHANGELOG.md b/CHANGELOG.md index ce47604..4df3669 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.3.6] + +* [Process Management] Overhaul Windows launcher process management strategy to be more resilient. This unfortunately will have processes launch in the foreground but will be more stable. + ## [2.3.5] * [Process Management] Windows launcher fix edge case diff --git a/app/core/server-process-manager.js b/app/core/server-process-manager.js index 0745c6f..e593a9f 100644 --- a/app/core/server-process-manager.js +++ b/app/core/server-process-manager.js @@ -420,7 +420,15 @@ module.exports = { ); } - require('child_process').exec(startProcessString); + let startArgs = ["/c"].concat(startProcessString.split(" ")).concat(args); + + require('child_process').spawn("cmd.exe", startArgs, + { + detached: true, + stdio: 'ignore', + cwd: pathManager.getEmuServerPath() + } + ); config.setAdminPanelConfig('launcher.isRunning', true); console.log("[Process Manager] Starting server launcher..."); @@ -438,7 +446,7 @@ module.exports = { */ async cancelRestart(options = []) { if (options.cancel) { - this.cancelTimedRestart = true; + this.cancelTimedRestart = true; this.cancelTimedShutdown = true; await serverDataService.messageWorld('[SERVER MESSAGE] Server stop cancelled'); } @@ -558,13 +566,12 @@ module.exports = { process_name + '.exe', ); - require('child_process').spawn(startProcessString, args, + let startArgs = ["/c", "start", "/B"].concat(startProcessString.split(" ")).concat(args); + require('child_process').spawn("cmd.exe", startArgs, { - cwd: pathManager.emuServerPath, detached: true, - shell: false, - stdio: 'pipe', - windowsHide: true, + stdio: 'ignore', + cwd: pathManager.getEmuServerPath() } ); } @@ -578,7 +585,7 @@ module.exports = { require('child_process').spawn(startProcessString, { - cwd: pathManager.emuServerPath, + cwd: pathManager.getEmuServerPath(), encoding: 'utf8', shell: '/bin/bash', detached: true @@ -630,7 +637,7 @@ module.exports = { this.systemProcessList.forEach((process) => { // statics - if (process.name.includes("zone") && process.cmd.includes(" ")) { + if (process.cmd.includes("zone") && process.cmd.includes(" ")) { try { const zone = process.cmd.split(" ")[1].trim() this.onlineStatics.push(zone) @@ -658,8 +665,8 @@ module.exports = { if (os.isWindows()) { const stdout = require('child_process') - .execSync("WMIC path win32_process get Description,Commandline,Processid /format:csv") - .toString(); + .execSync("WMIC path win32_process get Description,Commandline,Processid /format:csv") + .toString(); stdout.split('\n').forEach((row) => { if (row.includes(",") && !row.includes("Description,ProcessId")) { @@ -668,12 +675,12 @@ module.exports = { const splitLength = splitRow.length; const processId = splitRow[splitLength - 1].trim(); const simpleProcessName = splitRow[splitLength - 2].replace('.exe', '').trim(); - const cmdlineSplit = row - .replace("," + splitRow[splitLength - 1].trim(), '') - .replace("," + splitRow[splitLength - 2].trim(), '') - .split(","); + const cmdlineSplit = row + .replace("," + splitRow[splitLength - 1].trim(), '') + .replace("," + splitRow[splitLength - 2].trim(), '') + .split(","); - let commandLine = ""; + let commandLine = ""; if (cmdlineSplit.length > 1) { commandLine = cmdlineSplit[1].trim(); } @@ -681,7 +688,7 @@ module.exports = { const proc = { "name": simpleProcessName, "pid": processId, - "cmd": commandLine + "cmd": commandLine.replace(/\s+/g, ' ') }; processList.push(proc); diff --git a/package.json b/package.json index 5031f9e..3a1e523 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eqemu-admin", - "version": "2.3.5", + "version": "2.3.6", "private": true, "bin": "./app/bin/admin", "scripts": {