[Process] Avoid zombie process in case of unit tests failure
This commit is contained in:
parent
3ef517b356
commit
57d4159133
|
@ -263,7 +263,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
public function testStop()
|
||||
{
|
||||
$process = $this->getProcess('php -r "while (true) {}"');
|
||||
$process = $this->getProcess('php -r "sleep(4);"');
|
||||
$process->start();
|
||||
$this->assertTrue($process->isRunning());
|
||||
$process->stop();
|
||||
|
@ -279,7 +279,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
public function testIsNotSuccessful()
|
||||
{
|
||||
$process = $this->getProcess('php -r "while (true) {}"');
|
||||
$process = $this->getProcess('php -r "sleep(4);"');
|
||||
$process->start();
|
||||
$this->assertTrue($process->isRunning());
|
||||
$process->stop();
|
||||
|
@ -314,7 +314,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
$process = $this->getProcess('php -r "while (true) {}"');
|
||||
$process = $this->getProcess('php -r "sleep(4);"');
|
||||
$process->start();
|
||||
$process->stop();
|
||||
$this->assertTrue($process->hasBeenSignaled());
|
||||
|
@ -329,7 +329,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||
// SIGTERM is only defined if pcntl extension is present
|
||||
$termSignal = defined('SIGTERM') ? SIGTERM : 15;
|
||||
|
||||
$process = $this->getProcess('php -r "while (true) {}"');
|
||||
$process = $this->getProcess('php -r "sleep(4);"');
|
||||
$process->start();
|
||||
$process->stop();
|
||||
|
||||
|
@ -360,7 +360,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
// Sleep doesn't work as it will allow the process to handle signals and close
|
||||
// file handles from the other end.
|
||||
$process = $this->getProcess('php -r "while (true) {}"');
|
||||
$process = $this->getProcess('php -r "sleep 4"');
|
||||
$process->start();
|
||||
|
||||
// PHP will deadlock when it tries to cleanup $process
|
||||
|
|
Reference in New Issue