Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Process] Always call proc_close #16875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions src/Symfony/Component/Process/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,7 @@ public function __construct($commandline, $cwd = null, array $env = null, $stdin

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()
Expand Down
11 changes: 4 additions & 7 deletions src/Symfony/Component/Process/Tests/AbstractProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -709,26 +709,23 @@ public function testCheckTimeoutOnTerminatedProcess()
*/
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,9 @@ public function testProcessWithoutTermSignal()
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');
}

/**
Expand Down