ProcessBuilder::getProcess()

Process getProcess() Creates a Process instance and returns it. Return Value Process Exceptions LogicException In case no arguments have been provided

ProcessBuilder::enableOutput()

ProcessBuilder enableOutput() Enables fetching output and error output from the underlying process. Return Value ProcessBuilder

ProcessBuilder::disableOutput()

ProcessBuilder disableOutput() Disables fetching output and error output from the underlying process. Return Value ProcessBuilder

ProcessBuilder::create()

static ProcessBuilder create(array $arguments = array()) Creates a process builder instance. Parameters array $arguments An array of arguments Return Value ProcessBuilder

ProcessBuilder::addEnvironmentVariables()

ProcessBuilder addEnvironmentVariables(array $variables) Adds a set of environment variables. Already existing environment variables with the same name will be overridden by the new values passed to this method. Pass null to unset a variable. Parameters array $variables The variables Return Value ProcessBuilder

ProcessBuilder::add()

ProcessBuilder add(string $argument) Adds an unescaped argument to the command string. Parameters string $argument A command argument Return Value ProcessBuilder

ProcessBuilder

class ProcessBuilder Process builder. Methods __construct(array $arguments = array()) Constructor. static ProcessBuilder create(array $arguments = array()) Creates a process builder instance. ProcessBuilder add(string $argument) Adds an unescaped argument to the command string. ProcessBuilder setPrefix(string|array $prefix) Adds a prefix to the command string. ProcessBuilder setArguments(array $arguments) Sets the arguments of the process. ProcessBuilder setWorki

Process::wait()

int wait(callable $callback = null) Waits for the process to terminate. The callback receives the type of output (out or err) and some bytes from the output in real-time while writing the standard input to the process. It allows to have feedback from the independent process during execution. Parameters callable $callback A valid PHP callback Return Value int The exitcode of the process Exceptions RuntimeException When process timed out RuntimeException When process stopped afte

Process::stop()

int stop(int|float $timeout = 10, int $signal = null) Stops the process. Parameters int|float $timeout The timeout in seconds int $signal A POSIX signal to send in case the process has not stop at timeout, default is SIGKILL (9) Return Value int The exit-code of the process

Process::start()

start(callable $callback = null) Starts the process and returns after writing the input to STDIN. This method blocks until all STDIN data is sent to the process then it returns while the process runs in the background. The termination of the process can be awaited with wait(). The callback receives the type of output (out or err) and some bytes from the output in real-time while writing the standard input to the process. It allows to have feedback from the independent process during