MISC: add stopFlag check before running main (#1689)

It's possible that before the script starts runn, the stopFlag is set.
This commit is contained in:
Caldwell 2024-10-08 07:57:35 +02:00 committed by GitHub
parent 4d60c833cc
commit ccd9118b93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -56,6 +56,9 @@ async function startNetscript2Script(workerScript: WorkerScript): Promise<void>
const loadedModule = await compile(script, scripts);
// if for whatever reason the stopFlag is already set we abort
if (workerScript.env.stopFlag) return;
if (!loadedModule) throw `${script.filename} cannot be run because the script module won't load`;
const mainFunc = loadedModule.main;
// TODO unplanned: Better error for "unexpected reserved word" when using await in non-async function?