NAME

unix::run — Run a program as a child process.

synopsis

wyrm::unix::run [ -env {variable value...} ] [ -noin | -invar var ] [ -noout | -out script | -outvar var ] [ -noerr | -err script | -errvar var ] [ -wait script ] [ -- ] file-path argument...

description

This command runs a special case of fork and exec to handle a common case. It runs the program with the standard in, out, and error reopenned to either /dev/null or a pipe. All open channels in the interpretter are flushed prior to the fork.

This runs as

Create pipes.
Flush all channels.
Fork.
Parent.
Arrange the parent ends of the pipes.
If -out or -err are specified, wyrm::unix::reader until is used to drive the scripts. Within the scripts, the substrings %F are replaced with pipe channel names.
Run the wait script.
Call wyrm::unix::until to wait for the readers if necessary.
Wait for the child.
Return the exit or terminated status.
.
Child.
Dup pipes to standard file descriptors or close and open as /dev/null.
Exec the program.
The program exits.
.

SEE ALSO

unix-fork (1WY), unix-dup (1WY), unix-dev-null (1WY), unix-reader (1WY), unix-until (1WY), unix-exec (1WY).