ballerina/os

Overview

This module provides APIs to retrieve information about the environment variables and the current users of the Operating System.

The APIs are platform-independent, i.e., uniform across all operating systems.

For information on the operations, which you can perform with the os module, see the below Functions.

Functions

[7]

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.

listEnv

Returns a map of environment variables.

setEnv

Sets the value of the environment variable named by the key.

unsetEnv

Removes a single environment variable from the system if it exists.

Classes

[1]

Process

This object contains information on a process being created from Ballerina.

Records

[2]

Command
EnvProperties

Errors

[2]

Error

Represents OS module related errors.

ProcessExecError

Process Execution error that returns when the os:Exec function fails.