Name
proc_open
Synopsis
resource proc_open(stringcommand, arraydescriptors, arraypipes[, stringdir[, arrayenv[, arrayoptions]]])
Opens a pipe to a process executed by running
command on the shell, with a variety of
options. The descriptors parameter must be an array with three
elements—in order, they describe the stdin, stdout, and stderr descriptors. For each, specify either
an array containing two elements or a stream resource. In the first
case, if the first element is "pipe", the second element is either
"r" to read from the pipe or
"w" to write to the pipe. If the
first is "file", the second must be
a filename. The pipes array is filled with
an array of file pointers corresponding to the processes’ descriptors.
If dir is specified, the process has its
current working directory set to that path. If
env is specified, the process has its
environment set up with the values from that array. Finally,
options contains an associative array with
additional options. The following options can be set in the
array:
| If set and true, suppresses errors generated by the process (Windows only). |
| If set and true, bypasses cmd.exe when running the process. |
| If set, specifies the stream context when opening files. |
If any error occurs while attempting to open the process,
false is returned. If not, the
resource handle for the process is returned.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access