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:
Fabien Potencier 2012-04-12 06:56:15 +02:00
commit 3923ade0aa
2 changed files with 18 additions and 0 deletions

View File

@ -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.
*

View File

@ -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(