Merge pull request #405 from hydroflame/detect-main

fixed nsjs script with no main causing unkillable zombie scripts
This commit is contained in:
danielyxie 2018-08-02 10:43:43 -04:00 committed by GitHub
commit d38cf88c50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -39,8 +39,7 @@ export async function executeJSScript(scripts = [], workerScript) {
// TODO: putting await in a non-async function yields unhelpful // TODO: putting await in a non-async function yields unhelpful
// "SyntaxError: unexpected reserved word" with no line number information. // "SyntaxError: unexpected reserved word" with no line number information.
if (!loadedModule.main) { if (!loadedModule.main) {
throw makeRuntimeRejectMsg(script.filename + throw makeRuntimeRejectMsg(workerScript, `${script.filename} cannot be run because it does not have a main function.`);
" did not have a main function, cannot run it.");
} }
return loadedModule.main(ns); return loadedModule.main(ns);
} finally { } finally {