mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 20:55:44 +01:00
Fix atExit loop
atExit clears itself from the WorkerScript before being executed.
This commit is contained in:
parent
3c7b0622a5
commit
37d2f57e53
@ -66,11 +66,12 @@ function stopAndCleanUpWorkerScript(ws: WorkerScript): void {
|
|||||||
if (typeof ws.atExit === "function") {
|
if (typeof ws.atExit === "function") {
|
||||||
try {
|
try {
|
||||||
ws.env.stopFlag = false;
|
ws.env.stopFlag = false;
|
||||||
ws.atExit();
|
const atExit = ws.atExit;
|
||||||
|
ws.atExit = undefined;
|
||||||
|
atExit();
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
handleUnknownError(e, ws, "Error running atExit function.\n\n");
|
handleUnknownError(e, ws, "Error running atExit function.\n\n");
|
||||||
}
|
}
|
||||||
ws.atExit = undefined;
|
|
||||||
}
|
}
|
||||||
ws.env.stopFlag = true;
|
ws.env.stopFlag = true;
|
||||||
removeWorkerScript(ws);
|
removeWorkerScript(ws);
|
||||||
|
Loading…
Reference in New Issue
Block a user