Skip to content

Commit

Permalink
up: update the execAndPrint() error output style
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Apr 20, 2022
1 parent 3d5c546 commit b347e8c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Cmd/AbstractCmdBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ protected function execAndPrint(string $command, string $workDir): void
[$exitCode, $lastLine] = Exec::system($command, $workDir);

$this->code = $exitCode;
$this->output = trim($lastLine);
$this->output = $msg = trim($lastLine);

if ($exitCode !== 0) {
$this->error = $this->output;
$this->printMessage("error code $exitCode:\n" . $lastLine, self::PRINT_ERROR);
$this->printMessage("error: exit code $exitCode" . ($msg ? "\n $msg" : ''), self::PRINT_ERROR);
} else {
echo "\n";
}
Expand Down

0 comments on commit b347e8c

Please sign in to comment.