Process

GitHub   Edit on GitHub

Utilities for accessing functionality and information about the Grain program’s process.

This includes things like accessing environment variables and sending signals.

1
import Process from "sys/process"

Types

Type declarations included in the Process module.

Process.Signal

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
enum Signal {
HUP,
INT,
QUIT,
ILL,
TRAP,
ABRT,
BUS,
FPE,
KILL,
USR1,
SEGV,
USR2,
PIPE,
ALRM,
TERM,
CHLD,
CONT,
STOP,
TSTP,
TTIN,
TTOU,
URG,
XCPU,
XFSZ,
VTALRM,
PROF,
WINCH,
POLL,
PWR,
SYS,
}

Signals that can be sent to the host system.


Values

Functions and constants included in the Process module.

Process.argv

1
argv : () -> Result<Array<String>, Exception>

Access command line arguments.

Returns:

type description
Result<Array<String>, Exception> Ok(args) of an array containing positional string arguments to the process if successful or Err(exception) otherwise

Process.env

1
env : () -> Result<Array<String>, Exception>

Access environment variables.

Returns:

type description
Result<Array<String>, Exception> Ok(vars) of an array containing environment variables supplied to the process if successful or Err(exception) otherwise

Process.exit

1
exit : Number -> Result<Void, Exception>

Terminate the process normally.

Parameters:

param type description
code Number The value to exit with. An exit code of 0 is considered normal, with other values having meaning depending on the platform

Returns:

type description
Result<Void, Exception> Err(exception) if unsuccessful. Will not actually return a value if successful, as the process has ended

Process.sigRaise

1
sigRaise : Signal -> Result<Void, Exception>

Send a signal to the process of the calling thread.

Parameters:

param type description
signal Signal The signal to send

Returns:

type description
Result<Void, Exception> Ok(void) if successful or Err(exception) otherwise

Process.schedYield

1
schedYield : () -> Result<Void, Exception>

Yield execution to the calling thread.

Returns:

type description
Result<Void, Exception> Ok(void) if successful or Err(exception) otherwise
This is a notification!