Skip to content

Commit b347e8c

Browse files
committed
up: update the execAndPrint() error output style
1 parent 3d5c546 commit b347e8c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Cmd/AbstractCmdBuilder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ protected function execAndPrint(string $command, string $workDir): void
183183
[$exitCode, $lastLine] = Exec::system($command, $workDir);
184184

185185
$this->code = $exitCode;
186-
$this->output = trim($lastLine);
186+
$this->output = $msg = trim($lastLine);
187187

188188
if ($exitCode !== 0) {
189189
$this->error = $this->output;
190-
$this->printMessage("error code $exitCode:\n" . $lastLine, self::PRINT_ERROR);
190+
$this->printMessage("error: exit code $exitCode" . ($msg ? "\n $msg" : ''), self::PRINT_ERROR);
191191
} else {
192192
echo "\n";
193193
}

0 commit comments

Comments
 (0)