Skip to content

Commit 5e84d21

Browse files
authored
Fix STDERR Output (#257)
1 parent 7ca56f6 commit 5e84d21

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/Console/RunCommand.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,27 +188,23 @@ protected function passToRemoteProcessor(Task $task)
188188
/**
189189
* Display the given output line.
190190
*
191-
* @param int $type
191+
* @param string $type
192192
* @param string $host
193193
* @param string $line
194194
* @return void
195195
*/
196196
protected function displayOutput($type, $host, $line)
197197
{
198-
$lines = explode("\n", $line);
198+
$lines = array_filter(array_map('trim', explode("\n", $line)));
199199

200200
$hostColor = $this->getHostColor($host);
201201

202202
foreach ($lines as $line) {
203-
if (strlen(trim($line)) === 0) {
204-
continue;
203+
if ($type === Process::ERR) {
204+
$line = '<fg=red>'.$line.'</>';
205205
}
206206

207-
if ($type == Process::OUT) {
208-
$this->output->write($hostColor.': '.trim($line).PHP_EOL);
209-
} else {
210-
$this->output->write($hostColor.': '.'<fg=red>'.trim($line).'</>'.PHP_EOL);
211-
}
207+
$this->output->write($hostColor.': '.$line.PHP_EOL);
212208
}
213209
}
214210

0 commit comments

Comments
 (0)