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.
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).
| Member | Type | Notes |
|---|---|---|
process.argv | string[] | The launcher path followed by the user-supplied positional arguments. Read-only. |
process.execArgv | string[] | JVM arguments passed to the host process (e.g. —enable-preview). Read-only. |
process.env | Record | Per-realm snapshot of host environment variables. See semantics below. |
process.exitCode | number | Mutable; used as the default host exit code (honored at termination and reported to the exit event). |
process.platform | string | One of "linux", "darwin", "win32". Mirrors Node's value on the same host. |
process.nextTick | (fn, ...args) => void | Schedules fn on the next-tick queue, ahead of Promise microtasks. See below. |
process.stdout | Writable | Writable stream for fd 1. See below. |
process.stderr | Writable | Writable stream for fd 2. See below. |
process.stdin | Readable | Readable stream for fd 0. See below. |
process.on / emit / … | Function | process is an EventEmitter. See Events below. |
process.arch | string | CPU architecture the binary targets (e.g. "x64", "arm64"). Read-only. |
process.pid | number | Process ID. Read-only. |
process.ppid | number | Parent process ID. Read-only. |
process.version | string | Version string reported for the runtime. Read-only. |
process.versions | Record | Version strings for the runtime and bundled components (Node-style). Read-only. |
process.title | string | Process title; readable and writable. |
process.argv0 | string | The original argv[0]. Read-only. |
process.execPath | string | Absolute path of the running executable. Read-only. |
process.config | object | Elide build-feature flags (debug, release, javascript, …) plus a target string. Read-only. |
process.exit | (code?) => never | Terminates the process with code, or process.exitCode if omitted. |
process.emitWarning | (warning, options?) => void | Emits a warning event (see Events below). |
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.exitCodeif 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 (anextTickcallback, 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 byprocess.emitWarning. A default listener prints unhandled warnings to stderr.
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.HostEnvironmentand 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.spawnwill inherit the pre-mutation host environment unless the call passes an explicitenv.
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:
if (failed) {
process.exitCode = 1;
}Limitations
process.kill,process.send,process.disconnect, thechild_processnamespace, andprocess.bindingare not implemented.process.versionsexposes Elide's runtime version; the Node, V8, and OpenSSL sub-versions are best-effort surrogates.process.envcannot be reassigned wholesale (process.env = {...}); the binding is an own data property ofprocessand individual entries remain writable.