os/execute
core-api
cfunction
src/core/os.c on line 1381, column 1
(os/execute args &opt flags env)
Execute a program on the system and return the exit code. `args` is
an array/tuple of strings. The first string is the name of the
program and the remainder are arguments passed to the program.
`flags` is a keyword made from the following characters that
modifies how the program executes:
* :e - enables passing an environment to the program. Without 'e',
the current environment is inherited.
* :p - allows searching the current PATH for the program to
execute. Without this flag, the first element of `args` must be
an absolute path.
* :x - raises error if exit code is non-zero.
* :d - prevents the garbage collector terminating the program (if
still running) and calling the equivalent of `os/proc-wait`
(allows zombie processes).
`env` is a table/struct mapping environment variables to values. It
can also contain the keys :in, :out, and :err, which allow
redirecting stdio in the subprocess. :in, :out, and :err should be
core/file or core/stream values. If core/stream values are used,
the caller is responsible for ensuring pipes do not cause the
program to block and deadlock.