Open powturns opened 7 years ago
Hi @51systems, I started to use rocketeers few days ago and I was faced to the same issue. I made a dirty workaround to check my command returned code :
$lastCmdRegex = '/last_cmd_returned_value=:(\d+):/';
$r = $task->runForCurrentRelease(["node_modules/.bin/gulp --production && echo \"last_cmd_returned_value=:$?:\""]);
$match = [];
if(is_string($r)) {
preg_match($lastCmdRegex, $r, $match);
}
if ( !$task->command->option('pretend') && (!isset($match[1]) || (isset($match[1]) && (int) $match[1] != 0)) ) {
return $task->halt('Build assets failed, cancelling deployment (trace: ' . json_encode(['returned_value_match' => $match, 'returned_value' => $r]) . ')');
}
I hope this will help you,
Regards
When using a custom event to run a binary, it would be nice to be able to retrieve the return code to check if the command ran successfully. In the below example, I want to run gulp, but if the binary fails to run, the deployment continues, leaving the site in a broken state.
Anyone know any workarounds for this? Thanks!