1. Module (scheme process-context

Module (scheme process-context

[procedure] (command-line)

Returns the command line passed to the process as a list of strings. The first string corresponds to the command name. It is an error to mutate any of these strings.

[procedure] (exit [obj])

Runs all outstanding dynamic-wind after procedures, terminates the running program, and communicates an exit value to the operating system. If no argument is supplied, or if obj is #t, the exit procedure should communicate to the operating system that the program exited normally. If obj is #f, the exit procedure should communicate to the operating system that the program exited abnormally. Otherwise, exit should translate obj into an appropriate exit value for the operating system, if possible.

The exit procedure must not signal an exception or return to its continuation.

Note: Because of the requirement to run handlers, this procedure is not just the operating system's exit procedure.

[procedure] (emergency-exit [obj])

Terminates the program without running any outstanding dynamic-wind after procedures and communicates an exit value to the operating system in the same manner as exit.

Note: The emergency-exit procedure corresponds to the _exit procedure in Windows and Posix.

[procedure] (get-environment-variable name)

Many operating systems provide each running process with an environment consisting of environment variables. (This environment is not to be confused with the Scheme environments that can be passed to eval) Both the name and value of an environment variable are strings. The procedure get-environment-variable returns the value of the environment variable name, or #f if the named environment variable is not found. It may use locale information to encode the name and decode the value of the environment variable. It is an error if get-environment-variable can’t decode the value. It is also an error to mutate the resulting string.

(get-environment-variable "PATH") 
==> "/usr/local/bin:/usr/bin:/bin"
[procedure] (get-environment-variables)

Returns the names and values of all the environment variables as an alist, where the car of each entry is the name of an environment variable and the cdr is its value, both as strings. The order of the list is unspecified. It is an error to mutate any of these strings or the alist itself.

(get-environment-variables)
==> (("USER" . "root") ("HOME" . "/"))

Previous: Module (scheme lazy)

Next: Module (scheme read)