Skip to content
Open
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
3 changes: 2 additions & 1 deletion src/Common/ExecCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ protected function executeCommand($command)
$this,
$result_data->getExitCode(),
$result_data->getMessage(),
$result_data->getData()
$result_data->getData(),
$result_data->getErrorOutput()
);
}
}
6 changes: 4 additions & 2 deletions src/Common/ExecTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ protected function execute($process, $output_callback = null)
return new ResultData(
$this->process->getExitCode(),
$this->process->getOutput(),
$this->getResultData()
$this->getResultData(),
$this->process->getErrorOutput(),
);
}

Expand All @@ -408,7 +409,8 @@ protected function execute($process, $output_callback = null)
return new ResultData(
$this->process->getExitCode(),
$e->getMessage(),
$this->getResultData()
$this->getResultData(),
$this->process->getErrorOutput(),
);
}
return new ResultData($this->process->getExitCode());
Expand Down
7 changes: 4 additions & 3 deletions src/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ class Result extends ResultData implements OutputAwareInterface, InflectionInter
* @param int $exitCode
* @param string $message
* @param array $data
* @param string $errorOutput
*/
public function __construct(TaskInterface $task, $exitCode, $message = '', $data = [])
public function __construct(TaskInterface $task, $exitCode, $message = '', $data = [], $errorOutput = '')
{
parent::__construct($exitCode, $message, $data);
parent::__construct($exitCode, $message, $data, $errorOutput);
$this->task = $task;
$this->inflect($task);
$this->printResult();
Expand Down Expand Up @@ -292,6 +293,6 @@ public function injectDependencies($child)
*/
private function exitEarly($status)
{
throw new TaskExitException($this->getTask(), $this->getMessage(), $status);
throw new TaskExitException($this->getTask(), $this->getErrorOutput(), $status);
}
}
17 changes: 16 additions & 1 deletion src/ResultData.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ class ResultData extends Data implements ExitCodeInterface, OutputDataInterface
*/
protected $exitCode;

/**
* @var string
*/
protected $errorOutput;

const EXITCODE_OK = 0;
const EXITCODE_ERROR = 1;
/** Symfony Console handles these conditions; Robo returns the status
Expand All @@ -30,10 +35,12 @@ class ResultData extends Data implements ExitCodeInterface, OutputDataInterface
* @param int $exitCode
* @param string $message
* @param array $data
* @param string $errorOutput
*/
public function __construct($exitCode = self::EXITCODE_OK, $message = '', $data = [])
public function __construct($exitCode = self::EXITCODE_OK, $message = '', $data = [], $errorOutput = '')
{
$this->exitCode = $exitCode;
$this->errorOutput = $errorOutput;
parent::__construct($message, $data);
}

Expand Down Expand Up @@ -108,4 +115,12 @@ public function wasCancelled()
{
return $this->exitCode == self::EXITCODE_USER_CANCEL;
}

/**
* @return string
*/
public function getErrorOutput()
{
return $this->errorOutput;
}
}