Esc
Start typing to search...

Process Module

Process control, environment, and timing operations.

Functions

Process.args

() -> [String]

Return the command-line arguments passed to the program.

Example:
import Process

Process.args ()

-- ["arg1", "arg2", ...]
Try it

Notes: Excludes the program name. Takes Unit to trigger execution.

See also: Process.env

Process.env

String -> Maybe String

Get the value of an environment variable.

Example:
import Process

Process.env "PATH"

-- Just "/usr/bin:..."
Try it

See also: Process.setEnv, Process.args

Process.exit

Int -> ()

Exit the process with the given exit code.

Example:
import Process

Process.exit 0
Try it

Notes: This function never returns.

Process.hostname

() -> String

Return the hostname of the machine running the current process.

Example:
import Process

Process.hostname ()

-- e.g. "myhost"
Try it

Notes: Returns "unknown" if the hostname cannot be determined. Takes Unit to trigger execution.

See also: Process.pid

Process.pid

() -> Int

Return the process ID of the current process.

Example:
import Process

Process.pid ()

-- e.g. 12345
Try it

Notes: Takes Unit to trigger execution.

See also: Process.hostname

Process.setEnv

String -> String -> ()

Set an environment variable. KEEL_* variables cannot be set.

Example:
import Process

Process.setEnv "MY_VAR" "my_value"
Try it

Notes: Changes only affect the current process. Setting KEEL_* variables is an error.

See also: Process.env

Process.uptime

() -> Int

Return the number of milliseconds since the current program began executing.

Example:
import Process

Process.uptime ()

-- e.g. 42
Try it

Notes: Takes Unit to trigger execution.

See also: Process.wait

Process.wait

Int -> ()

Sleep for the given number of milliseconds. Blocks the current thread.

Example:
import Process

Process.wait 500
Try it

Notes: Negative values are treated as zero.

See also: Process.uptime