[Process] Properly close pipes after a Process::stop call
This commit is contained in:
parent
e6d983c22f
commit
d84df4c2c5
@ -626,9 +626,13 @@ class Process
|
|||||||
$this->signal($signal ?: SIGKILL);
|
$this->signal($signal ?: SIGKILL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->updateStatus(false);
|
$this->updateStatus(false);
|
||||||
|
if ($this->processInformation['running']) {
|
||||||
|
$this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->status = self::STATUS_TERMINATED;
|
$this->status = self::STATUS_TERMINATED;
|
||||||
|
|
||||||
return $this->exitcode;
|
return $this->exitcode;
|
||||||
|
@ -477,6 +477,21 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertFalse($process->isSuccessful());
|
$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()
|
public function testGetPid()
|
||||||
{
|
{
|
||||||
$process = $this->getProcess('php -r "sleep(1);"');
|
$process = $this->getProcess('php -r "sleep(1);"');
|
||||||
|
Reference in New Issue
Block a user