Process
Edit on GitHubUtilities for accessing functionality and information about the Grain program’s process.
This includes things like accessing environment variables and sending signals.
Types
Type declarations included in the Process module.
Process.Signal
Signals that can be sent to the host system.
Variants:
Hangup.
Terminate interrupt signal.
Terminal quit signal.
Illegal instruction.
Trace/breakpoint trap.
Process abort signal.
Access to an undefined portion of a memory object.
Erroneous arithmetic operation.
Kill.
User-defined signal 1.
Invalid memory reference.
User-defined signal 2.
Write on a pipe with no one to read it.
Alarm clock.
Termination signal.
Child process terminated, stopped, or continued.
Continue executing, if stopped.
Stop executing.
Terminal stop signal.
Background process attempting read.
Background process attempting write.
High bandwidth data is available at a socket.
CPU time limit exceeded.
File size limit exceeded.
Virtual timer expired.
Bad system call.
Values
Functions and constants included in the Process module.
Process.argv
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
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
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
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
Yield execution to the calling thread.
Returns:
type | description |
---|---|
Result<Void, Exception> |
Ok(void) if successful or Err(exception) otherwise |