diff --git a/lib/main.ts b/lib/main.ts index 0f68f999..598cc536 100644 --- a/lib/main.ts +++ b/lib/main.ts @@ -3,7 +3,7 @@ import { type Operation } from "./types.ts"; import { callcc } from "./callcc.ts"; import { run } from "./run.ts"; import { useScope } from "./scope.ts"; -import process from "node:process"; +import { call } from "./call.ts"; /** * Halt process execution immediately and initiate shutdown. If a message is @@ -96,6 +96,9 @@ export async function main( } }, *node() { + let { default: process } = yield* call(() => + import("node:process") + ); hardexit = (status) => process.exit(status); try { process.on("SIGINT", interrupt.SIGINT); @@ -164,7 +167,7 @@ function* withHost(op: HostOperation): Operation { // @see https://github.com/iliakan/detect-node/blob/master/index.js } else if ( Object.prototype.toString.call( - typeof process !== "undefined" ? process : 0, + typeof globalThis.process !== "undefined" ? globalThis.process : 0, ) === "[object process]" ) { return yield* op.node();