Module jls.lang.runtime
Provides interaction with the underlying OS runtime.
Functions
exec (command, env, dir) | Executes the specified command and arguments in a separate process with the specified environment and working directory. |
execute (command[, anyCode[, callback]]) | Executes the specified command line in a separate thread. |
exit (code) | Terminates the program and returns a value to the OS. |
gc () | Runs the garbage collector. |
halt (code) | Forcibly terminates the program and returns a value to the OS. |
Functions
- exec (command, env, dir)
-
Executes the specified command and arguments in a separate process with the specified environment and working directory.
Parameters:
- command Array of strings specifying the command-line arguments. The first argument is the name of the executable file.
- env Array of key=values specifying the environment strings. If undefined, the new process inherits the environment of the parent process.
- dir The working directory of the subprocess, or undefined if the subprocess should inherit the working directory of the current process.
Returns:
-
jls.lang.ProcessHandle
a handle of the new process
- execute (command[, anyCode[, callback]])
-
Executes the specified command line in a separate thread.
The promise will be rejected if the process exit code is not zero.
The error is a table with a code and a kind fields.
Parameters:
- command string The command-line to execute.
- anyCode boolean true to resolve the promise with any exit code. (optional)
- callback function an optional callback function to use in place of promise. (optional)
Returns:
-
jls.lang.Promise
a promise that resolves once the command has been executed.
- exit (code)
-
Terminates the program and returns a value to the OS.
Parameters:
- code The exit code to return to the OS.
- gc ()
- Runs the garbage collector.
- halt (code)
-
Forcibly terminates the program and returns a value to the OS.
Parameters:
- code The exit code to return to the OS.