diff --git a/src/Netscript/killWorkerScript.ts b/src/Netscript/killWorkerScript.ts index b172abf24..918930ecb 100644 --- a/src/Netscript/killWorkerScript.ts +++ b/src/Netscript/killWorkerScript.ts @@ -66,8 +66,6 @@ function killWorkerScriptByPid(pid: number, rerenderUi = true): boolean { } function stopAndCleanUpWorkerScript(workerScript: WorkerScript, rerenderUi = true): void { - workerScript.env.stopFlag = true; - killNetscriptDelay(workerScript); if (typeof workerScript.atExit === "function") { try { workerScript.atExit(); @@ -78,6 +76,8 @@ function stopAndCleanUpWorkerScript(workerScript: WorkerScript, rerenderUi = tru } workerScript.atExit = undefined; } + workerScript.env.stopFlag = true; + killNetscriptDelay(workerScript); removeWorkerScript(workerScript, rerenderUi); } diff --git a/src/NetscriptEvaluator.ts b/src/NetscriptEvaluator.ts index 0b3f8841b..f724eb690 100644 --- a/src/NetscriptEvaluator.ts +++ b/src/NetscriptEvaluator.ts @@ -18,7 +18,7 @@ export function makeRuntimeRejectMsg(workerScript: WorkerScript, msg: string): s throw new Error(`WorkerScript constructed with invalid server ip: ${workerScript.hostname}`); } - return "|" + server.hostname + "|" + workerScript.name + "|" + msg; + return "|DELIMITER|" + server.hostname + "|DELIMITER|" + workerScript.name + "|DELIMITER|" + msg; } export function resolveNetscriptRequestedThreads( @@ -50,7 +50,7 @@ export function isScriptErrorMessage(msg: string): boolean { if (!isString(msg)) { return false; } - const splitMsg = msg.split("|"); + const splitMsg = msg.split("|DELIMITER|"); if (splitMsg.length != 4) { return false; } diff --git a/src/NetscriptWorker.ts b/src/NetscriptWorker.ts index 4a1b43a97..517135fa2 100644 --- a/src/NetscriptWorker.ts +++ b/src/NetscriptWorker.ts @@ -539,7 +539,7 @@ function createAndAddWorkerScript(runningScriptObj: RunningScript, server: BaseS return; } else if (w instanceof WorkerScript) { if (isScriptErrorMessage(w.errorMessage)) { - const errorTextArray = w.errorMessage.split("|"); + const errorTextArray = w.errorMessage.split("|DELIMITER|"); if (errorTextArray.length != 4) { console.error("ERROR: Something wrong with Error text in evaluator..."); console.error("Error text: " + w.errorMessage); diff --git a/src/ui/WorkInProgressRoot.tsx b/src/ui/WorkInProgressRoot.tsx index a9a8fd68f..ef4d4b8f4 100644 --- a/src/ui/WorkInProgressRoot.tsx +++ b/src/ui/WorkInProgressRoot.tsx @@ -222,7 +222,7 @@ export function WorkInProgressRoot(): React.ReactElement { if (player.workType == CONSTANTS.WorkTypeCompanyPartTime) { function cancel(): void { - player.finishWork(true); + player.finishWorkPartTime(true); router.toJob(); } function unfocus(): void {