Module

Node.Process

Package
purescript-node-process
Repository
purescript-node/purescript-node-process

Bindings to the global process object in Node.js. See also the Node API documentation

#onBeforeExit Source

onBeforeExit :: Effect Unit -> Effect Unit

Register a callback to be performed when the event loop empties, and Node.js is about to exit. Asynchronous calls can be made in the callback, and if any are made, it will cause the process to continue a little longer.

#onExit Source

onExit :: (Int -> Effect Unit) -> Effect Unit

Register a callback to be performed when the process is about to exit. Any work scheduled via asynchronous calls made here will not be performed in time.

The argument to the callback is the exit code which the process is about to exit with.

#onSignal Source

onSignal :: Signal -> Effect Unit -> Effect Unit

Install a handler for a particular signal.

#argv Source

argv :: Effect (Array String)

Get an array containing the command line arguments. Be aware that this can change over the course of the program.

#execArgv Source

execArgv :: Effect (Array String)

Node-specific options passed to the node executable. Be aware that this can change over the course of the program.

#execPath Source

execPath :: Effect String

The absolute pathname of the node executable that started the process.

#chdir Source

chdir :: String -> Effect Unit

Change the current working directory of the process. If the current directory could not be changed, an exception will be thrown.

#cwd Source

cwd :: Effect String

Get the current working directory of the process.

#getEnv Source

getEnv :: Effect (Object String)

Get a copy of the current environment.

#lookupEnv Source

lookupEnv :: String -> Effect (Maybe String)

Lookup a particular environment variable.

#setEnv Source

setEnv :: String -> String -> Effect Unit

Set an environment variable.

#exit Source

exit :: forall a. Int -> Effect a

Cause the process to exit with the supplied integer code. An exit code of 0 is normally considered successful, and anything else is considered a failure.

#stdin Source

stdin :: Readable ()

The standard input stream. Note that this stream will never emit an end event, so any handlers attached via onEnd will never be called.

#stdout Source

stdout :: Writable ()

The standard output stream. Note that this stream cannot be closed; calling end will result in an exception being thrown.

#stderr Source

stderr :: Writable ()

The standard error stream. Note that this stream cannot be closed; calling end will result in an exception being thrown.

#stdoutIsTTY Source

stdoutIsTTY :: Boolean

Check whether the standard output stream appears to be attached to a TTY. It is a good idea to check this before printing ANSI codes to stdout (e.g. for coloured text in the terminal).

#stderrIsTTY Source

stderrIsTTY :: Boolean

Check whether the standard error stream appears to be attached to a TTY. It is a good idea to check this before printing ANSI codes to stderr (e.g. for coloured text in the terminal).

#version Source

version :: String

Get the Node.js version.