On this page
Process Module
Process control, environment, and timing operations.
Functions
Process.args
() ->{Proc} [String]
Return the command-line arguments passed to the program.
import Process
Process.args ()
-- ["arg1", "arg2", ...]Notes: Excludes the program name. Takes Unit to trigger execution.
See also: Process.env
Process.env
String ->{Proc} Maybe String
Get the value of an environment variable.
import Process
Process.env "PATH"
-- Just "/usr/bin:..."See also: Process.setEnv, Process.args
Process.exit
Int ->{Proc} ()
End the program with the given exit code.
import Process
Process.exit 0Notes: This function never returns. A script run with halyard run ends its process with the code; in the REPL, a notebook or the playground only the current cell ends, and the session keeps running.
Process.hostname
() ->{Proc} String
Return the hostname of the machine running the current process.
import Process
Process.hostname ()
-- e.g. "myhost"Notes: Returns "unknown" if the hostname cannot be determined. Takes Unit to trigger execution.
See also: Process.pid
Process.pid
() ->{Proc} Int
Return the process ID of the current process.
import Process
Process.pid ()
-- e.g. 12345Notes: Takes Unit to trigger execution.
See also: Process.hostname
Process.setEnv
String -> String ->{Proc} ()
Set an environment variable. HALYARD_* variables cannot be set.
import Process
Process.setEnv "MY_VAR" "my_value"Notes: Changes only affect the current process. Setting HALYARD_* variables is an error.
See also: Process.env
Process.uptime
() ->{Proc} Int
Return the number of milliseconds since the current program began executing.
import Process
Process.uptime ()
-- e.g. 42Notes: Takes Unit to trigger execution.
See also: Process.wait
Process.wait
Int ->{Proc} ()
Sleep for the given number of milliseconds. Blocks the current thread.
import Process
Process.wait 500Notes: Negative values are treated as zero.
See also: Process.uptime