ESC
No recent searches
Search by
Standard Library  /  Process

Process

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

Edit on GitHub

This includes things like accessing environment variables and sending signals.

from "wasi/process" include Process

Types

Type declarations included in the Process module.

Process.Signal

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.

Variants:

HUP

Hangup.

INT

Terminate interrupt signal.

QUIT

Terminal quit signal.

ILL

Illegal instruction.

TRAP

Trace/breakpoint trap.

ABRT

Process abort signal.

BUS

Access to an undefined portion of a memory object.

FPE

Erroneous arithmetic operation.

KILL

Kill.

USR1

User-defined signal 1.

SEGV

Invalid memory reference.

USR2

User-defined signal 2.

PIPE

Write on a pipe with no one to read it.

ALRM

Alarm clock.

TERM

Termination signal.

CHLD

Child process terminated, stopped, or continued.

CONT

Continue executing, if stopped.

STOP

Stop executing.

TSTP

Terminal stop signal.

TTIN

Background process attempting read.

TTOU

Background process attempting write.

URG

High bandwidth data is available at a socket.

XCPU

CPU time limit exceeded.

XFSZ

File size limit exceeded.

VTALRM

Virtual timer expired.

SYS

Bad system call.

Values

Functions and constants included in the Process module.

Process.argv

argv : () => Result<Array<String>, Exception>

Access command line arguments.

Returns:

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

Process.env

env : () => Result<Array<String>, Exception>

Access environment variables.

Returns:

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

Process.exit

exit : (code: Number) => Result<Void, Exception>

Terminate the process normally.

Parameters:

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

Returns:

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

Process.sigRaise

sigRaise : (signal: Signal) => Result<Void, Exception>

Send a signal to the process of the calling thread.

Parameters:

signal: The signal to send

Returns:

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

Process.schedYield

schedYield : () => Result<Void, Exception>

Yield execution to the calling thread.

Returns:

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

Sign up for farm-to-inbox developer news

You can unsubscribe at any time. Read our privacy policy.

Copyright © 2024 The Grain Programming Language