Process

js.node.events.EventEmitterjs.node.Process (extern class)

Instance Members

A Writable Stream to stdout.

stderr and stdout are unlike other streams in Node in that writes to them are usually blocking.


A writable stream to stderr.

stderr and stdout are unlike other streams in Node in that writes to them are usually blocking.


A Readable Stream for stdin.


argv: Array<String>

An array containing the command line arguments. The first element will be node, the second element will be the name of the JavaScript file. The next elements will be any additional command line arguments.

E.g: $ node process-2.js one two=three four 0: node 1: /Users/mjr/work/node/process-2.js 2: one 3: two=three 4: four


execPath: String

This is the absolute pathname of the executable that started the process.


execArgv: Array<String>

This is the set of node-specific command line options from the executable that started the process. These options do not show up in argv, and do not include the node executable, the name of the script, or any options following the script name.

These options are useful in order to spawn child processes with the same execution environment as the parent.


An object containing the user environment. See environ(7).


exitCode: Null<Int>

A number which will be the process exit code, when the process either exits gracefully, or is exited via process.exit() without specifying a code.

Specifying a code to process.exit(code) will override any previous setting of process.exitCode.


version: String

A compiled-in property that exposes NODE_VERSION.


A property exposing version strings of node and its dependencies.


config: Dynamic

An Object containing the JavaScript representation of the configure options that were used to compile the current node executable. This is the same as the "config.gypi" file that was produced when running the ./configure script.


pid: Int

The PID of the process.


title: String

Getter/setter to set what is displayed in 'ps'.

When used as a setter, the maximum length is platform-specific and probably short. On Linux and OS X, it's limited to the size of the binary name plus the length of the command line arguments because it overwrites the argv memory.


arch: String

What processor architecture you're running on: 'arm', 'ia32', or 'x64'.


platform: String

What platform you're running on: 'darwin', 'freebsd', 'linux', 'sunos' or 'win32'


ppid: Int

The PID of the parent process


release: Release

The metadata of the current release


report: Report

Used for diagnostic reports


mainModule: Module

Alternate way to retrieve require.main. The difference is that if the main module changes at runtime, require.main might still refer to the original main module in modules that were required before the change occurred. Generally it's safe to assume that the two refer to the same module.

As with require.main, it will be undefined if there was no entry script.


noDeprecation: Bool

Disable run-time deprecation warnings. See Util.deprecate.


traceDeprecation: Bool

Enable logging of deprecation warnings. See Util.deprecate.


throwDeprecation: Bool

Throw on deprecated API usage. See Util.deprecate.


abort(): Void

This causes node to emit an abort. This will cause node to exit and generate a core file.


chdir(directory: String): Void

Changes the current working directory of the process or throws an exception if that fails.

Name Type
directory String

cwd(): String

Returns the current working directory of the process.

Returns
String

exit(?code: Int): Void

Ends the process with the specified code. If the code is omitted, exit uses either the 'success' code 0 or the value of process.exitCode if specified.

Name Type Default
code Int (optional)

getgid(): Int

Gets the group identity of the process. See getgid(2). Note: this function is only available on POSIX platforms (i.e. not Windows)

Returns
Int

setgid(id: Int): Void

Sets the group identity of the process. See setgid(2). This accepts either a numerical ID or a groupname string. If a groupname is specified, this method blocks while resolving it to a numerical ID.

Note: this function is only available on POSIX platforms (i.e. not Windows)

Name Type
id Int

getuid(): Int

Gets the user identity of the process. See getuid(2). Note: this function is only available on POSIX platforms (i.e. not Windows)

Returns
Int

setuid(id: Int): Void

Sets the user identity of the process. See setuid(2). This accepts either a numerical ID or a username string. If a username is specified, this method blocks while resolving it to a numerical ID.

Note: this function is only available on POSIX platforms (i.e. not Windows)

Name Type
id Int

getgroups(): Array<Int>

Returns an array with the supplementary group IDs. POSIX leaves it unspecified if the effective group ID is included but node.js ensures it always is. Note: this function is only available on POSIX platforms (i.e. not Windows)

Returns
Array<Int>

Sets the supplementary group IDs. This is a privileged operation, meaning you need to be root or have the CAP_SETGID capability.

Note: this function is only available on POSIX platforms (i.e. not Windows) The list can contain group IDs, group names or both.

Name Type
groups Array<haxe.extern.EitherType<String, Int>>

Reads /etc/group and initializes the group access list, using all groups of which the user is a member. This is a privileged operation, meaning you need to be root or have the CAP_SETGID capability.

Note: this function is only available on POSIX platforms (i.e. not Windows)

Name Type
user haxe.extern.EitherType<String, Int>
extra_group haxe.extern.EitherType<String, Int>

kill(pid: Int, ?signal: String): Void

Send a signal to a process. pid is the process id and signal is the string describing the signal to send. Signal names are strings like 'SIGINT' or 'SIGHUP'.

If omitted, the signal will be 'SIGTERM'. See Signal Events and kill(2) for more information.

Will throw an error if target does not exist, and as a special case, a signal of 0 can be used to test for the existence of a process.

Note that just because the name of this function is kill, it is really just a signal sender, like the kill system call. The signal sent may do something other than kill the target process.

Name Type Default
pid Int
signal String (optional)

memoryUsage(): MemoryUsage

Returns an object describing the memory usage of the Node process measured in bytes.

Returns
MemoryUsage

nextTick(callback: Function, args: haxe.extern.Rest): Void

On the next loop around the event loop call this callback. This is not a simple alias to setTimeout(fn, 0), it's much more efficient. It typically runs before any other I/O events fire, but there are some exceptions.

This is important in developing APIs where you want to give the user the chance to assign event handlers after an object has been constructed, but before any I/O has occurred.

Name Type
callback Function
args haxe.extern.Rest

umask(?mask: Int): Int

Sets or reads the process's file mode creation mask. Child processes inherit the mask from the parent process. Returns the old mask if mask argument is given, otherwise returns the current mask.

Name Type Default
mask Int (optional)
Returns
Int

uptime(): Float

Number of seconds Node has been running.

Returns
Float

hrtime(): Array<Float>

Returns the current high-resolution real time in a [seconds, nanoseconds] tuple Array. It is relative to an arbitrary time in the past. It is not related to the time of day and therefore not subject to clock drift. The primary use is for measuring performance between intervals. You may pass in the result of a previous call to hrtime to get a diff reading, useful for benchmarks and measuring intervals

Returns
Array<Float>

send(message: Dynamic, ?callback: Function): Bool

Send a message to the parent process.

Only available for child processes. See ChildProcess.send.

Name Type Default
message Dynamic
callback Function (optional)
Returns
Bool

disconnect(): Void

Close the IPC channel to parent process.

Only available for child processes. See ChildProcess.disconnect.