Lines Matching defs:process

70     private $process;
117 145 => 'Child process terminated, stopped (or continued*)',
121 149 => 'Background process attempting to read from tty ("in")',
122 150 => 'Background process attempting to write to tty ("out")',
136 * @param string|null $cwd The working directory or null to use the working dir of the current PHP process
137 * @param array|null $env The environment variables or null to use the same environment as the current PHP process
179 * $process = Process::fromShellCommandline('my_command "${:MY_VAR}"');
180 * $process->run(null, ['MY_VAR' => $theValue]);
183 * @param string|null $cwd The working directory or null to use the working dir of the current PHP process
184 * @param array|null $env The environment variables or null to use the same environment as the current PHP process
194 $process = new static([], $cwd, $env, $input, $timeout);
195 $process->commandline = $command;
197 return $process;
228 * Runs the process.
232 * from the independent process during execution.
234 * The STDOUT and STDERR are also available after the process is finished
242 * @throws RuntimeException When process can't be launched
243 * @throws RuntimeException When process is already running
244 * @throws ProcessTimedOutException When process timed out
245 * @throws ProcessSignaledException When process stopped after receiving signal
258 * Runs the process.
260 * This is identical to run() except that an exception is thrown if the process
265 * @throws ProcessFailedException if the process didn't terminate successfully
279 * Starts the process and returns after writing the input to STDIN.
281 * This method blocks until all STDIN data is sent to the process then it
282 * returns while the process runs in the background.
284 * The termination of the process can be awaited with wait().
287 * the output in real-time while writing the standard input to the process.
288 * It allows to have feedback from the independent process during execution.
293 * @throws RuntimeException When process can't be launched
294 * @throws RuntimeException When process is already running
319 // exec is mandatory to deal with sending a signal to the process
332 // See https://unix.stackexchange.com/questions/71205/background-process-pipe-input
352 $this->process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options);
354 if (!\is_resource($this->process)) {
355 throw new RuntimeException('Unable to launch a new process.');
372 * Restarts the process.
374 * Be warned that the process is cloned before being started.
381 * @throws RuntimeException When process can't be launched
382 * @throws RuntimeException When process is already running
394 $process = clone $this;
395 $process->start($callback, $env);
397 return $process;
401 * Waits for the process to terminate.
404 * from the output in real-time while writing the standard input to the process.
405 * It allows to have feedback from the independent process during execution.
409 * @return int The exitcode of the process
411 * @throws ProcessTimedOutException When process timed out
412 * @throws ProcessSignaledException When process stopped after receiving signal
413 * @throws LogicException When process is not yet started
451 * from the output in real-time while writing the standard input to the process.
452 * It allows to have feedback from the independent process during execution.
454 * @throws RuntimeException When process timed out
455 * @throws LogicException When process is not yet started
494 * Returns the Pid (process identifier), if applicable.
496 * @return int|null The process id if running, null otherwise
504 * Sends a POSIX signal to the process.
510 * @throws LogicException In case the process is not running
511 * @throws RuntimeException In case --enable-sigchild is activated and the process can't be killed
522 * Disables fetching output and error output from the underlying process.
526 * @throws RuntimeException In case the process is already running
532 throw new RuntimeException('Disabling output while the process is running is not possible.');
544 * Enables fetching output and error output from the underlying process.
548 * @throws RuntimeException In case the process is already running
553 throw new RuntimeException('Enabling output while the process is running is not possible.');
572 * Returns the current output of the process (STDOUT).
577 * @throws LogicException In case the process is not started
599 * @throws LogicException In case the process is not started
616 * Returns an iterator to the output of the process, with the output type as keys (Process::OUT/ERR).
621 * @throws LogicException In case the process is not started
674 * Clears the process output.
688 * Returns the current error output of the process (STDERR).
693 * @throws LogicException In case the process is not started
716 * @throws LogicException In case the process is not started
733 * Clears the process output.
747 * Returns the exit code returned by the process.
759 * Returns a string representation for the exit code returned by the process.
779 * Checks if the process ended successfully.
789 * Returns true if the child process has been terminated by an uncaught signal.
795 * @throws LogicException In case the process is not terminated
805 * Returns the number of the signal that caused the child process to terminate its execution.
812 * @throws LogicException In case the process is not terminated
826 * Returns true if the child process has been stopped by a signal.
832 * @throws LogicException In case the process is not terminated
842 * Returns the number of the signal that caused the child process to stop its execution.
848 * @throws LogicException In case the process is not terminated
858 * Checks if the process is currently running.
874 * Checks if the process has been started with no regard to the current state.
884 * Checks if the process is terminated.
896 * Gets the process status.
910 * Stops the process.
913 * @param int $signal A POSIX signal to send in case the process has not stop at timeout, default is SIGKILL (9)
915 * @return int|null The exit-code of the process or null if it's not running
928 // Avoid exception here: process is supposed to be running, but it might have stopped just
993 * Gets the process timeout in seconds (max. runtime).
1003 * Gets the process idle timeout in seconds (max. time since last output).
1013 * Sets the process timeout (max. runtime) in seconds.
1029 * Sets the process idle timeout (max. time since last output) in seconds.
1168 * This content will be passed to the underlying process standard input.
1174 * @throws LogicException In case the process is running
1179 throw new LogicException('Input cannot be set while the process is running.');
1188 * Performs a check between the timeout definition and the time the process started.
1190 * In case you run a background process (with the start method), you should
1191 * trigger this method regularly to ensure the process timeout
1215 * @throws LogicException in case process is not started
1220 throw new LogicException('Start time is only available after process start.');
1232 * to run after the main process exited, on both Windows and *nix
1237 throw new RuntimeException('Setting options while the process is running is not possible.');
1335 * Updates the status of the process, reads pipes.
1345 $this->processInformation = proc_get_status($this->process);
1386 * @throws LogicException in case output has been disabled or process is not started
1438 * Closes process resource, closes file handles, sets the exitcode.
1445 if (\is_resource($this->process)) {
1446 proc_close($this->process);
1453 // if process has been signaled, no exitcode but a valid termsig, apply Unix convention
1470 * Resets data related to the latest run of the process.
1481 $this->process = null;
1489 * Sends a POSIX signal to the process.
1494 * @throws LogicException In case the process is not running
1495 * @throws RuntimeException In case --enable-sigchild is activated and the process can't be killed
1502 throw new LogicException('Cannot send signal on a non running process.');
1512 throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
1519 $ok = @proc_terminate($this->process, $signal);
1589 * Ensures the process is running or terminated, throws a LogicException if the process has a not started.
1591 * @throws LogicException if the process has not run
1601 * Ensures the process is terminated, throws a LogicException if the process has a status different than "terminated".
1603 * @throws LogicException if the process is not yet terminated