Gio.ApplicationCommandLine.prototype.getenv

function getenv(name: String): String {
    // Gjs wrapper for g_application_command_line_getenv()
}
  

Gets the value of a particular environment variable of the command line invocation, as would be returned by GLib.getenv. The strings may contain non-utf8 data.

The remote application usually does not send an environment. Use Gio.ApplicationFlags.send_environment to affect that. Even with this flag set it is possible that the environment is still not available (due to invocation messages from other applications).

The return value should not be modified or freed and is valid for as long as cmdline exists.

Since 2.28

name

the environment variable to get

Returns

the value of the variable, or null if unset or unsent