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

#PROCESS Source

data PROCESS :: Effect

An effect tracking interaction with the global process object.

#onBeforeExit Source

onBeforeExit :: forall eff. Eff (process :: PROCESS | eff) Unit -> Eff (process :: PROCESS | eff) 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 :: forall eff. (Int -> Eff (process :: PROCESS | eff) Unit) -> Eff (process :: PROCESS | eff) 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 :: forall eff. Signal -> Eff (process :: PROCESS | eff) Unit -> Eff (process :: PROCESS | eff) Unit

Install a handler for a particular signal.

#argv Source

argv :: forall eff. Eff (process :: PROCESS | eff) (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 :: forall eff. Eff (process :: PROCESS | eff) (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 :: forall eff. Eff (process :: PROCESS | eff) String

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

#chdir Source

chdir :: forall eff. String -> Eff (err :: EXCEPTION, process :: PROCESS | eff) 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 :: forall eff. Eff (process :: PROCESS | eff) String

Get the current working directory of the process.

#getEnv Source

getEnv :: forall eff. Eff (process :: PROCESS | eff) (StrMap String)

Get a copy of the current environment.

#lookupEnv Source

lookupEnv :: forall eff. String -> Eff (process :: PROCESS | eff) (Maybe String)

Lookup a particular environment variable.

#setEnv Source

setEnv :: forall eff. String -> String -> Eff (process :: PROCESS | eff) Unit

Set an environment variable.

#exit Source

exit :: forall a eff. Int -> Eff (process :: PROCESS | eff) 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 :: forall eff. Readable () (console :: CONSOLE | eff)

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 :: forall eff. Writable () (console :: CONSOLE, err :: EXCEPTION | eff)

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

#stderr Source

stderr :: forall eff. Writable () (console :: CONSOLE, err :: EXCEPTION | eff)

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.