Skip to content

Env

[Source]

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

class val Env

Constructors

_create

[Source]

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

[Source]

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

new val create(
  root': (AmbientAuth val | None val),
  input': InputStream tag,
  out': OutStream tag,
  err': OutStream tag,
  args': Array[String val] val,
  vars': Array[String val] val,
  exitcode': {(I32)} val)
: Env val^

Parameters

Returns


Public fields

let root: (AmbientAuth val | None val)

[Source]

The root capability.

Can be None for artificially constructed Env instances.


let input: InputStream tag

[Source]

Stdin represented as an actor.


let out: OutStream tag

[Source]

Stdout


let err: OutStream tag

[Source]

Stderr


let args: Array[String val] val

[Source]

The command line used to start the program.


let vars: Array[String val] val

[Source]

The program's environment variables.


let exitcode: {(I32)} val

[Source]

Sets the environment's exit code. The exit code of the root environment will be the exit code of the application, which defaults to 0.


Private Functions

_count_strings

[Source]

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

Parameters

Returns


_strings_from_pointers

[Source]

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

Parameters

Returns