Functions - system

exec

Executes an operating system command as a subprocess of the current process.

getEnv

Returns the environment variable value associated with the provided name.

getUserHome

Returns the current user's home directory path.

getUsername

Returns the current user's name.

uuid

Returns a random UUID string.

exec

(string command, map env, string? dir, string[] args)

returns Process | Error

Executes an operating system command as a subprocess of the current process.

Parameters

  • command string
  • The name of the command to be executed

  • env map - {}
  • Environment variables to be set to the process

  • dir string? - ()
  • The current working directory to be set to the process

  • args string[]
  • Command arguments to be passed in

  • Return Type

    (Process | Error)
  • Returns a Process object in success, or an Error if a failure occurs

getEnv

(string name)

returns string

Returns the environment variable value associated with the provided name.

Parameters

  • name string
  • Name of the environment variable

  • Return Type

    (string)
  • Environment variable value if it exists, otherwise an empty string

getUserHome

()

returns string

Returns the current user's home directory path.

  • Return Type

    (string)
  • Current user's home directory if it can be determined, an empty string otherwise

getUsername

()

returns string

Returns the current user's name.

  • Return Type

    (string)
  • Current user's name if it can be determined, an empty string otherwise

uuid

()

returns string

Returns a random UUID string.

  • Return Type

    (string)
  • The random string