Process execution. import process, effect.
Execute a command and return its stdout as a string
let output = process.exec("ls", ["-la"])
Exit the process with the given status code
process.exit(1)
Read all lines from standard input
let lines = process.stdin_lines()
Execute a command in a specific working directory
let output = process.exec_in("/tmp", "pwd", [])
Execute a command with input piped to its stdin
let output = process.exec_with_stdin("cat", [], "hello")
process.exec_status(cmd: String, args: List[String]) -> Result[{code: Int, stdout: String, stderr: String}, String]
Execute a command and return exit code, stdout, and stderr
let r = process.exec_status("ls", []) // {code, stdout, stderr}
Get the value of an environment variable, or None if not set
let home = process.env("HOME") ?? "/tmp"
Spawn a child process without waiting, return its PID
let pid = process.spawn("node", ["server.js"])
Send a signal to a process by PID (e.g. 15 for SIGTERM, 9 for SIGKILL)
process.kill(pid, 15)
Check if a process with the given PID is still running
let running = process.is_alive(pid)
Get command-line arguments as a list of strings.
let args = process.args()
Get the current process ID.
let my_pid = process.pid()