Env

An environment holds the command line and other values injected into the program by default by the runtime.

class val Env

Constructors

_create

Builds an environment from the command line. This is done before the Main actor is created.

new ref _create(
  argc: U32 val,
  argv: Pointer[Pointer[U8 val] ref] val,
  envp: Pointer[Pointer[U8 val] ref] val)
: Env ref^

Parameters

Returns


create

Build an artificial environment. A root capability may be supplied.

new ref create(
  root': (AmbientAuth val | None val),
  input': Stdin tag,
  out': StdStream tag,
  err': StdStream tag,
  args': Array[String val] val,
  vars': (Array[String val] val | None val))
: Env ref^

Parameters

Returns


Public fields






Public Functions

vars

Return the environment variables as an array of strings of the form "key=value".

fun box vars()
: Array[String val] val

Returns


exitcode

Sets the application exit code. If this is called more than once, the last value set will be the exit code. The exit code defaults to 0.

fun tag exitcode(
  code: I32 val)
: None val

Parameters

  • code: I32 val

Returns


Private Functions

_count_strings

fun tag _count_strings(
  data: Pointer[Pointer[U8 val] ref] val)
: USize val

Parameters

Returns


_strings_from_pointers

fun tag _strings_from_pointers(
  data: Pointer[Pointer[U8 val] ref] val,
  len: USize val)
: Array[String val] iso^

Parameters

Returns