mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-10 18:30:51 +08:00
17 lines
465 B
PHP
17 lines
465 B
PHP
<?php
|
|
|
|
namespace App\Console;
|
|
|
|
trait ExecuteCommandTrait
|
|
{
|
|
protected function executeCommand($command)
|
|
{
|
|
$this->info("Running $command ...");
|
|
$result = exec($command, $output, $result_code);
|
|
do_log(sprintf('command: %s, result_code: %s, output: %s, result: %s', $command, $result_code, json_encode($output), $result));
|
|
if ($result_code != 0) {
|
|
throw new \RuntimeException(json_encode($output));
|
|
}
|
|
}
|
|
}
|