Process::setEnhanceSigchildCompatibility()

Process setEnhanceSigchildCompatibility(bool $enhance) Activates sigchild compatibility mode. Sigchild compatibility mode is required to get the exit code and determine the success of a process when PHP has been compiled with the --enable-sigchild option Parameters bool $enhance Return Value Process The current Process instance

Process::setCommandLine()

Process setCommandLine(string $commandline) Sets the command line to be executed. Parameters string $commandline The command to execute Return Value Process The current Process instance

Process::run()

int run(callable|null $callback = null) Runs the process. The callback receives the type of output (out or err) and some bytes from the output in real-time. It allows to have feedback from the independent process during execution. The STDOUT and STDERR are also available after the process is finished via the getOutput() and getErrorOutput() methods. Parameters callable|null $callback A PHP callback to run whenever there is some output available on STDOUT or STDERR Return Value

Process::restart()

Process restart(callable $callback = null) Restarts the process. Be warned that the process is cloned before being started. Parameters callable $callback A PHP callback to run whenever there is some output available on STDOUT or STDERR Return Value Process The new process Exceptions RuntimeException When process can't be launched RuntimeException When process is already running See also start()

Process::mustRun()

Process mustRun(callable $callback = null) Runs the process. This is identical to run() except that an exception is thrown if the process exits with a non-zero exit code. Parameters callable $callback Return Value Process Exceptions RuntimeException if PHP was compiled with --enable-sigchild and the enhanced sigchild compatibility mode is not enabled ProcessFailedException if the process didn't terminate successfully

Process::isTty()

bool isTty() Checks if the TTY mode is enabled. Return Value bool true if the TTY mode is enabled, false otherwise

Process::isTerminated()

bool isTerminated() Checks if the process is terminated. Return Value bool true if process is terminated, false otherwise

Process::isSuccessful()

bool isSuccessful() Checks if the process ended successfully. Return Value bool true if the process ended successfully, false otherwise

Process::isStarted()

bool isStarted() Checks if the process has been started with no regard to the current state. Return Value bool true if status is ready, false otherwise

Process::isRunning()

bool isRunning() Checks if the process is currently running. Return Value bool true if the process is currently running, false otherwise