exec(
path,args,opts) ->proc,err
Execute an external command asynchronously
Spawns an external command as a child process with non-blocking pipe I/O
and pidfd-based exit notification. Returns a process handle with async
send, recv, recv_stderr, read_all, wait, and kill methods.
Options:
cwd (string): working directory for childenv (table): array of "KEY=VALUE" strings, replaces child environmentstderr_to_stdout (boolean): merge stderr into stdout stream. The child
gets no stderr pipe, and recv_stderr answers nil, "closed"new_session (boolean): start the child in a session of its own, with no
controlling terminal, so a terminal's Ctrl+C reaches the parent aloneThe child starts with no signal blocked and every caught handler at its
default, whatever signals the loop holds through on_signal. A send to a
child that has closed its stdin or exited answers nil, "closed" and raises
no SIGPIPE. An empty send answers the same, and 0 to a child that reads.
A program that closed its own stdin, stdout or stderr spawns as any other: the child moves its pipe ends above descriptor 2 before it redirects.
send(data, opts) takes a socket's limits: opts.timeout, 30 seconds
when nil and none when false, and opts.stall. A send that fails
returns nil, err, sent, where sent counts the bytes the pipe took.