diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/node/polyfills/vm.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/node/polyfills/vm.ts b/ext/node/polyfills/vm.ts index cb12f88e7..4ca375e88 100644 --- a/ext/node/polyfills/vm.ts +++ b/ext/node/polyfills/vm.ts @@ -4,6 +4,8 @@ import { notImplemented } from "ext:deno_node/_utils.ts"; +const { core } = globalThis.__bootstrap; + export class Script { code: string; constructor(code: string, _options = {}) { @@ -11,7 +13,11 @@ export class Script { } runInThisContext(_options: any) { - return eval.call(globalThis, this.code); + const [result, error] = core.evalContext(this.code, "data:"); + if (error) { + throw error.thrown; + } + return result; } runInContext(_contextifiedObject: any, _options: any) { |