createProcess = $createProcess !== null ? Closure::fromCallable($createProcess) : static fn (array $cmd) => new Process($cmd, null, null, null, LockedCommandConfig::DEFAULT_TTL); } public function run(OutputInterface $output, array $cmd): void { if ($output instanceof ConsoleOutputInterface) { $output = $output->getErrorOutput(); } /** @var DebugFormatterHelper $formatter */ $formatter = $this->helper->getHelperSet()?->get('debug_formatter') ?? new DebugFormatterHelper(); /** @var Process $process */ $process = ($this->createProcess)($cmd); if ($output->isVeryVerbose()) { $output->write( $formatter->start(spl_object_hash($process), str_replace('<', '\\<', $process->getCommandLine())), ); } $callback = $output->isDebug() ? $this->helper->wrapCallback($output, $process) : null; $process->mustRun($callback); if ($output->isVeryVerbose()) { $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf( '%s Command did not run successfully', $process->getExitCode(), ); $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful())); } } }