mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 17:43:48 +01:00
Merge pull request #3038 from Ornedan/fix-atexit-leak
Fix #3037: wrap user-supplied atExit function so that we can't accide…
This commit is contained in:
commit
3d6d729b33
@ -2279,7 +2279,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
|||||||
if (typeof f !== "function") {
|
if (typeof f !== "function") {
|
||||||
throw makeRuntimeErrorMsg("atExit", "argument should be function");
|
throw makeRuntimeErrorMsg("atExit", "argument should be function");
|
||||||
}
|
}
|
||||||
workerScript.atExit = f;
|
workerScript.atExit = () => { f(); }; // Wrap the user function to prevent WorkerScript leaking as 'this'
|
||||||
},
|
},
|
||||||
mv: function (host: string, source: string, destination: string): void {
|
mv: function (host: string, source: string, destination: string): void {
|
||||||
updateDynamicRam("mv", getRamCost(Player, "mv"));
|
updateDynamicRam("mv", getRamCost(Player, "mv"));
|
||||||
|
Loading…
Reference in New Issue
Block a user