[Process] Always call proc_close
This commit is contained in:
parent
800232c3d6
commit
ccb67d7bd2
@ -157,16 +157,7 @@ class Process
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
if ($this->isRunning()) {
|
||||
$this->doSignal(15, false);
|
||||
usleep(10000);
|
||||
}
|
||||
if ($this->isRunning()) {
|
||||
usleep(100000);
|
||||
$this->doSignal(9, false);
|
||||
}
|
||||
|
||||
// Don't call ->stop() nor ->close() since we don't want to wait for the subprocess here
|
||||
$this->stop(0);
|
||||
}
|
||||
|
||||
public function __clone()
|
||||
|
@ -709,26 +709,23 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testCheckTimeoutOnStartedProcess()
|
||||
{
|
||||
$timeout = 0.5;
|
||||
$precision = 100000;
|
||||
$process = $this->getProcess(self::$phpBin.' -r "sleep(3);"');
|
||||
$process->setTimeout($timeout);
|
||||
$start = microtime(true);
|
||||
$process->setTimeout(0.5);
|
||||
|
||||
$process->start();
|
||||
$start = microtime(true);
|
||||
|
||||
try {
|
||||
while ($process->isRunning()) {
|
||||
$process->checkTimeout();
|
||||
usleep($precision);
|
||||
usleep(100000);
|
||||
}
|
||||
$this->fail('A RuntimeException should have been raised');
|
||||
} catch (RuntimeException $e) {
|
||||
}
|
||||
$duration = microtime(true) - $start;
|
||||
|
||||
$this->assertLessThan($timeout + $precision, $duration);
|
||||
$this->assertFalse($process->isSuccessful());
|
||||
$this->assertLessThan(1, $duration);
|
||||
|
||||
throw $e;
|
||||
}
|
||||
|
@ -85,13 +85,9 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
|
||||
parent::testProcessWithoutTermSignal();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Process\Exception\RuntimeException
|
||||
* @expectedExceptionMessage This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.
|
||||
*/
|
||||
public function testCheckTimeoutOnStartedProcess()
|
||||
{
|
||||
parent::testCheckTimeoutOnStartedProcess();
|
||||
$this->markTestSkipped('Stopping with signal is not supported in sigchild environment');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user