mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-24 07:02:26 +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") {
|
||||
try {
|
||||
ws.env.stopFlag = false;
|
||||
ws.atExit();
|
||||
const atExit = ws.atExit;
|
||||
ws.atExit = undefined;
|
||||
atExit();
|
||||
} catch (e: unknown) {
|
||||
handleUnknownError(e, ws, "Error running atExit function.\n\n");
|
||||
}
|
||||
ws.atExit = undefined;
|
||||
}
|
||||
ws.env.stopFlag = true;
|
||||
removeWorkerScript(ws);
|
||||
|
Loading…
Reference in New Issue
Block a user