process

Elide installs the Node-style process object on globalThis. The fields documented below are stable; everything else is either Node-specific (and not yet implemented) or a host hook reserved for Elide internals.

The same object is importable as the node:process module — import process from "node:process" (or require("process")) returns the very same per-realm singleton as globalThis.process (a subset is also available as named exports: arch, pid, ppid, platform, version, execPath, title).
MemberTypeNotes
process.argvstring[]The launcher path followed by the user-supplied positional arguments. Read-only.
process.execArgvstring[]JVM arguments passed to the host process (e.g. —enable-preview). Read-only.
process.envRecordPer-realm snapshot of host environment variables. See semantics below.
process.exitCodenumberMutable; used as the default host exit code (honored at termination and reported to the exit event).
process.platformstringOne of "linux", "darwin", "win32". Mirrors Node's value on the same host.
process.nextTick(fn, ...args) => voidSchedules fn on the next-tick queue, ahead of Promise microtasks. See below.
process.stdoutWritableWritable stream for fd 1. See below.
process.stderrWritableWritable stream for fd 2. See below.
process.stdinReadableReadable stream for fd 0. See below.
process.on / emit / …Functionprocess is an EventEmitter. See Events below.
process.archstringCPU architecture the binary targets (e.g. "x64", "arm64"). Read-only.
process.pidnumberProcess ID. Read-only.
process.ppidnumberParent process ID. Read-only.
process.versionstringVersion string reported for the runtime. Read-only.
process.versionsRecordVersion strings for the runtime and bundled components (Node-style). Read-only.
process.titlestringProcess title; readable and writable.
process.argv0stringThe original argv[0]. Read-only.
process.execPathstringAbsolute path of the running executable. Read-only.
process.configobjectElide build-feature flags (debug, release, javascript, …) plus a target string. Read-only.
process.exit(code?) => neverTerminates the process with code, or process.exitCode if omitted.
process.emitWarning(warning, options?) => voidEmits a warning event (see Events below).
Not implemented — the following members exist on process but throw UnsupportedOperationException (process. is not yet implemented) when called: abort(), cwd(), chdir(), getuid(), getgid(), geteuid(), getegid(), hrtime(), umask(), cpuUsage(), memoryUsage(), and uptime().

Events

process is a Node EventEmitter: the full surface (on, once, off/removeListener, addListener, prependListener, prependOnceListener, removeAllListeners, emit, listeners, rawListeners, listenerCount, eventNames, setMaxListeners, getMaxListeners) is inherited from EventEmitter.prototype. The following lifecycle events are emitted by the runtime:
  • beforeExit — fired with the exit code when the event loop empties. A handler may schedule more asynchronous work, which the loop then drains.
  • exit — fired with the final exit code as the process terminates (process.exitCode if set, else 0, or the fatal code on an uncaught exception). Handlers run synchronously; async work scheduled from them is dropped.
  • uncaughtException — fired with (error, origin) when an exception escapes an asynchronous callback (a nextTick callback, a timer, …). With a handler registered the loop continues; with none, the error is printed to stderr and the process exits with code 1, as in Node.
  • unhandledRejection — fired with (reason, promise) for a rejected Promise with no rejection handler. A registered handler suppresses the default stderr report.
  • warning — fired with the warning object by process.emitWarning. A default listener prints unhandled warnings to stderr.
js
process.on("exit", (code) => console.log("exiting with", code));
process.on("uncaughtException", (err) => console.error("caught", err.message));

process.nextTick

process.nextTick(callback, ...args) enqueues callback on the next-tick queue. As in Node, the entire next-tick queue is drained ahead of the Promise microtask queue at every checkpoint, so a tick scheduled before a resolved Promise's .then runs first. A non-function callback throws a TypeError with code ERR_INVALID_ARG_TYPE.

process.stdout / process.stderr

Writable streams backed by the realm's output and error sinks (fds 1 and 2). Each is an EventEmitter exposing the Writable surface (write, end, cork/uncork, …) plus fd. console.log / console.error write through these streams, so replacing process.stdout.write intercepts console output (as in Node).

When the output is attached to a terminal, the stream also exposes isTTY (true), columns, rows, and getWindowSize(); for piped output these are absent (undefined), matching Node.

process.stdin

A Readable stream over fd 0. It is an EventEmitter supporting the usual consumption modes — on('data') / on('end'), read(), and async iteration (for await (const chunk of process.stdin)). Reads are performed off-thread so they never block the event loop, and an unconsumed stdin does not keep the process alive. When attached to a terminal, isTTY is true.

process.emitWarning

process.emitWarning(warning[, type[, code]][, ctor]) (or process.emitWarning(warning[, options])) emits the warning event on the next tick. With no user listener the default listener prints the warning to stderr.

process.env semantics

process.env is a plain JS object whose property set is materialised on first access from a single Elide-controlled host layer. The object is then cached for the lifetime of the realm:
  • First access: Elide reads the visible host environment names through dev.elide.cfg.HostEnvironment and installs each entry as a writable, configurable, enumerable own data property.
  • Subsequent reads: return whatever is currently on the cached object — so guest mutations (process.env.FOO = "bar") are observable to later reads inside the same realm.
  • Spawned children: Elide does not propagate guest mutations back to the OS environment. A future child_process.spawn will inherit the pre-mutation host environment unless the call passes an explicit env.

The visible name set is whatever the host layer chooses to expose. The default layer is a passthrough of the OS environment, matching Node. When Elide runs under a sandbox policy or a secrets provider, the host layer filters or overlays the values before they reach process.env — guest code cannot tell the difference between an "absent" name and a "denied" name, and cannot distinguish an OS-backed value from an Elide-managed secret.

process.exitCode

A mutable numeric slot. Setting it from inside the script changes the host process exit code at script termination:

js
if (failed) {
  process.exitCode = 1;
}

Limitations

  • process.kill, process.send, process.disconnect, the child_process namespace, and process.binding are not implemented.
  • process.versions exposes Elide's runtime version; the Node, V8, and OpenSSL sub-versions are best-effort surrogates.
  • process.env cannot be reassigned wholesale (process.env = {...}); the binding is an own data property of process and individual entries remain writable.