fix a few bug

This commit is contained in:
Olivier Gagnon 2021-10-22 15:21:10 -04:00
parent ffc8133fb8
commit dce11f525a
4 changed files with 6 additions and 6 deletions

@ -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);
}

@ -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;
}

@ -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);

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