process
Run shell commands and inspect the current process.
Import
import processFunctions
process.pid() -> int
Current process ID.
process.run(cmd: str) -> map
Run a shell command and wait for it to finish. Returns a map with:ok (bool), stdout (str), code (int).
Examples
import process
println(process.pid())
let r = process.run("echo hello")
println(r["stdout"]) -- hello
println(r["ok"]) -- true
println(r["code"]) -- 0
-- check a command exists
let which = process.run("which git")
if which["ok"] {
println("git found at: {which[""stdout"].trim()}")
} else {
println("git not found")
}