ProcessAPI
Node API: Process
Describes the "process" object, as specified by the Node JS "process" built-in module. The "process" object provides information about the current process, and allows the user to interact with the process environment. This includes such information as the process' environment variable access, current working directory, process ID, and so on.
Summary
The process
module is special in that it is both a module and a globally-available VM intrinsic; running under pure Node, one does not need to import or require anything at all and can just specify process.x
. Additionally, the process
module is made available as a standard built-in module. Elide supports both use styles.
Behavior
Depending on the access rights in the current environment, the process
object behaves roughly the same in Elide as it does in Node. Where values are forbidden for access or otherwise unavailable, sensible values are provided instead of their real counterparts (for example, -1
as the process ID).
Behavior and requisite access rights are described below for each property, along with any other applicable behavior:
process.env
: The environment variables of the current process. This is a read-only property. The values provided as "process environment" may be the real host environment or stubbed values, or both, and may include values from.env
files loaded on behalf of the user. By default, host environment access is not available to guests in Elide.process.argv
: The command-line arguments of the current process. This is a read-only property. The values provided here are available when a JavaScript file is used as the program entrypoint, and under normal operating circumstances, even if the entrypoint is implemented in another language. Thus, the first argument toargv
is always the Elide binary. In some circumstances, for example, render-only scripts, no arguments are available.process.exit(code)
: Exit the current process with the specified exit code. This method is available to all guests and will, by default, exit the entire VM, including the host context; if VM exit is disabled or forbidden, this method halts guest execution and returns control to the host.process.nextTick(callback, ...args)
: Schedule a callback to be invoked in the next tick of the event loop. This method is not implemented in Elide at the time of this writing.
See the Node Process API for more information.
See also
for details about how Elide handles Node-style environment access.
Properties
Access the environment variables of the current process.
Access to a stream for emitting content to stderr
.
Access to a stream for consuming content from stdin
.
Access to a stream for emitting content to stdout
.
Functions
Exit the current process with the specified exit code; uses code 0
.
Exit the current process with the specified exit code. This variant works on a host exit code Int.
Exit the current process with the specified exit code. This variant works on a guest Value.