[Process] Properly close pipes after a Process::stop call

This commit is contained in:
Romain Neutron 2013-09-16 13:32:46 +02:00
parent e6d983c22f
commit d84df4c2c5
2 changed files with 21 additions and 2 deletions

View File

@ -626,9 +626,13 @@ class Process
$this->signal($signal ?: SIGKILL);
}
}
$this->updateStatus(false);
}
$this->updateStatus(false);
if ($this->processInformation['running']) {
$this->close();
}
$this->status = self::STATUS_TERMINATED;
return $this->exitcode;

View File

@ -477,6 +477,21 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
$this->assertFalse($process->isSuccessful());
}
public function testStartAfterATimeout()
{
$process = $this->getProcess('php -r "while(true) {echo \'\'; usleep(1000); }"');
$process->setTimeout(0.1);
try {
$process->run();
$this->fail('An exception should have been raised.');
} catch (\Exception $e) {
}
$process->start();
usleep(10000);
$process->stop();
}
public function testGetPid()
{
$process = $this->getProcess('php -r "sleep(1);"');