improve sandbox resilience against process aborts (#5205)
authorAlex Lam S.L <alexlamsl@gmail.com>
Mon, 6 Dec 2021 20:54:58 +0000 (20:54 +0000)
committerGitHub <noreply@github.com>
Mon, 6 Dec 2021 20:54:58 +0000 (04:54 +0800)
test/sandbox.js

index 79b98a2..8ebbaab 100644 (file)
@@ -295,7 +295,7 @@ function run_code_exec(code, toplevel, timeout) {
         } catch (e) {}
     }
     var match = /\n([^:\s]*Error)(?:: ([\s\S]+?))?\n(    at [\s\S]+)\n$/.exec(msg);
-    if (!match) return details || new Error(msg);
+    if (!match) return details || new Error("Script execution aborted.");
     var ex = new global[match[1]](match[2]);
     ex.stack = ex.stack.slice(0, ex.stack.indexOf("    at ")) + match[3];
     if (typeof details == "object") {