improve usability (#5758)

This commit is contained in:
Alex Lam S.L
2022-12-04 03:10:32 +02:00
committed by GitHub
parent 0cbd5ea64a
commit 17c3ae6cba
18 changed files with 38 additions and 76 deletions

View File

@@ -2113,13 +2113,7 @@ if (require.main !== module) {
}
function run_code(code, toplevel, timeout) {
if (async && has_await) code = [
'"use strict";',
"(async()=>{",
code,
'})().catch(e=>process.on("exit",()=>{throw e}));',
].join("\n");
return sandbox.run_code(sandbox.patch_module_statements(code), toplevel, timeout);
return sandbox.run_code(sandbox.patch_module_statements(code, async && has_await), toplevel, timeout);
}
function writeln(stream, msg) {