Skip to content

Commit d3c8d9b

Browse files
committed
Always convert command result to string on completion
1 parent fcba1af commit d3c8d9b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/MonitoredCommand.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ protected function hasRunTooManyTimes()
184184
*/
185185
protected function complete($message = '')
186186
{
187+
$message = $this->stringFromMessage($message);
187188
$this->output->success($message);
188189
$this->commandRecord()->complete($message);
189190

@@ -198,12 +199,28 @@ protected function complete($message = '')
198199
*/
199200
protected function fail($message = '')
200201
{
202+
$message = $this->stringFromMessage($message);
201203
$this->output->error($message);
202204
$this->commandRecord()->fail($message);
203205

204206
return false;
205207
}
206208

209+
/**
210+
* Get a string representation of the command return value.
211+
*
212+
* @param mixed $message
213+
* @return string
214+
*/
215+
protected function stringFromMessage($message)
216+
{
217+
if (is_string($message)) {
218+
return $message;
219+
}
220+
221+
return var_export($message, true);
222+
}
223+
207224
/**
208225
* The custom monitored command functionality.
209226
*

0 commit comments

Comments
 (0)