Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e3c46cc

Browse filesBrowse files
committed
[Process] Stop the process correctly even if underlying input stream is not closed:
While checking a process to end, on posix system, process component only checks if pipes are still open, this fix ensure that if the process is terminated it correctly return, even if the underlying pipe is not closed. It can be useful when using \STDIN as a input stream as it will always be open
1 parent 4b842fc commit e3c46cc
Copy full SHA for e3c46cc

File tree

Expand file treeCollapse file tree

2 files changed

+11
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-1
lines changed

‎Process.php

Copy file name to clipboardExpand all lines: Process.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ public function wait(callable $callback = null)
428428

429429
do {
430430
$this->checkTimeout();
431-
$running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
431+
$running = $this->isRunning() && ('\\' === \DIRECTORY_SEPARATOR || $this->processPipes->areOpen());
432432
$this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
433433
} while ($running);
434434

‎Tests/ProcessTest.php

Copy file name to clipboardExpand all lines: Tests/ProcessTest.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,6 +1538,16 @@ public function testEnvCaseInsensitiveOnWindows()
15381538
}
15391539
}
15401540

1541+
public function testNotTerminableInputPipe()
1542+
{
1543+
$process = $this->getProcess('echo foo');
1544+
$process->setInput(\STDIN);
1545+
$process->start();
1546+
$process->setTimeout(2);
1547+
$process->wait();
1548+
$this->assertFalse($process->isRunning());
1549+
}
1550+
15411551
/**
15421552
* @param string|array $commandline
15431553
* @param mixed $input

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.