Symfony process control

598 Views Asked by At

I'm beginner in Symfony, I wanna know if there is any way to control the process of my functions ( I mean to stop it or to run it.. at any time I want) I found this case using the Symfony process library :

use Symfony\Component\Process\Process;

$process = new Process('#command');
$process->start();

// ... do other things

$process->stop(3, SIGINT);

But, is it necessary to use the process as a command?
Is it similar to pcntl_fork?

1

There are 1 best solutions below

0
On

if you use Process component from Symfony it will launch processess as commands, there are no other options right now. However you can still use pcntl PHP functions if you are sure there is no chance with Process class.

Take a look to Process class and you will realize that internally it is using pcntl constants as POSIX signals and so on. https://github.com/symfony/process/blob/master/Process.php