merged branch kimhemsoe/process_deadlock (PR #3888)
Commits
-------
89a5c1a
[process] Added destructor to process to make sure handles are always closed in the right order.
Discussion
----------
[process] Added destructor to process to make sure handles are always cl...
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
This commit is contained in:
commit
3923ade0aa
@ -133,6 +133,12 @@ class Process
|
|||||||
$this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
|
$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.
|
* 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()
|
public function responsesCodeProvider()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
|
Reference in New Issue
Block a user