[process] Added destructor to process to make sure handles are always closed in the right order.
This commit is contained in:
parent
b47cb35e7b
commit
89a5c1a845
@ -133,6 +133,12 @@ class Process
|
||||
$this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
// stop() will check if we have a process running.
|
||||
$this->stop();
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the process.
|
||||
*
|
||||
|
@ -121,6 +121,18 @@ class ProcessTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function testPhpDeadlock()
|
||||
{
|
||||
$this->markTestSkipped('Can course php to hang');
|
||||
|
||||
// Sleep dont work as it will allow the process to handle signals and close
|
||||
// file handles from the other end.
|
||||
$process = new Process('php -r "while (true) {}"');
|
||||
$process->start();
|
||||
|
||||
// PHP will deadlock when it tries to cleanup $process
|
||||
}
|
||||
|
||||
public function responsesCodeProvider()
|
||||
{
|
||||
return array(
|
||||
|
Reference in New Issue
Block a user