process
Built-in functions for the current process & child processes
Example usage
Properties
arch
The architecture of the processor currently being used.
Possible values:
"x86_64"
"aarch64"
cwd
The current working directory in which the Lune script is running.
os
The current operating system being used.
Possible values:
"linux"
"macos"
"windows"
Functions
exit
Exits the currently running script as soon as possible with the given exit code.
Exit code 0 is treated as a successful exit, any other value is treated as an error.
Setting the exit code using this function will override any otherwise automatic exit code.
spawn
Spawns a child process that will run the program program
, and returns a dictionary that describes the final status and ouput of the child process.
The second argument, params
, can be passed as a list of string parameters to give to the program.
The third argument, options
, can be passed as a dictionary of options to give to the child process. Refer to the documentation for SpawnOptions
for specific option keys and their values.
Types
Arch
OS
SpawnOptions
A dictionary of options for process.spawn
, with the following available values:
cwd
- The current working directory for the processenv
- Extra environment variables to give to the processshell
- Whether to run in a shell or not - set totrue
to run using the default shell, or a string to run using a specific shellstdio
- How to treat output and error streams from the child process - set to "inherit" to pass output and error streams to the current process
SpawnOptionsStdio
SpawnResult
Result type for child processes in process.spawn
.
This is a dictionary containing the following values:
ok
- If the child process exited successfully or not, meaning the exit code was zero or not setcode
- The exit code set by the child process, or 0 if one was not setstdout
- The full contents written to stdout by the child process, or an empty string if nothing was writtenstderr
- The full contents written to stderr by the child process, or an empty string if nothing was written
Last updated