diff --git a/src/commands/Command.php b/src/commands/Command.php index 94a3d66..1590fc9 100644 --- a/src/commands/Command.php +++ b/src/commands/Command.php @@ -13,6 +13,8 @@ use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\BufferedOutput; +use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; use Throwable; @@ -116,9 +118,18 @@ use Throwable; $app->setCatchExceptions(false); // force not catching exceptions $app->setAutoExit(false); // force not exiting try { + // if ($output instanceof ConsoleOutputInterface){ + // $errBuffer = new BufferedOutput(); + // $output->setErrorOutput($errBuffer); + // } $code = $app->run(new ArrayInput($def),$output); - if ($code != 0 && $code != 2){ + if ($code != 0){ $output->writeln("Commands {$def['command']} return code $code"); + // if ($errBuffer){ + // $errorOutput = $errBuffer->fetch(); + // $output->writeln("Error"); + // $output->writeln($errorOutput); + // } return Command::FAILURE; } } catch (Throwable $th){ @@ -149,8 +160,13 @@ use Throwable; if ($this->canRunPhpunit()){ $def = [ 'command' => 'exec', - 'binary' => 'phpunit' + 'binary' => 'phpunit', + // '-v' => '-v', // only for debug command exec ]; + $args = array_merge([ + // '-v' => '--verbose', // verbse phpunit + // '--debug' => '--debug', // debug phpunit + ],$args); if (!empty($args)){ $def['args'] = array_map(function($v){ return ($v == '--pversion') ? '--version' : $v; // hack to prevent bad caught