Symfony\Component\Process\Process::getExitCodeText PHP Method

getExitCodeText() public method

This method relies on the Unix exit code status standardization and might not be relevant for other operating systems.
See also: http://tldp.org/LDP/abs/html/exitcodes.html
See also: http://en.wikipedia.org/wiki/Unix_signal
public getExitCodeText ( ) : null | string
return null | string A string representation for the exit status code, null if the Process is not terminated
    public function getExitCodeText()
    {
        if (null === ($exitcode = $this->getExitCode())) {
            return;
        }
        return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
    }

Usage Example

Beispiel #1
0
 public function run(OutputInterface $output)
 {
     foreach ($this->queue as $command) {
         $process = new Process($command);
         if ($process->run()) {
             $output->writeln(sprintf('<error>%s:</error>', $process->getExitCodeText()));
             $output->writeln('');
             $output->writeln(sprintf('<error>%s</error>', $process->getErrorOutput()));
             return $process->getExitCode();
         } else {
             $output->writeln(sprintf('<info>%s</info>', $process->getExitCodeText()));
         }
     }
     // Ok
     return 0;
 }
All Usage Examples Of Symfony\Component\Process\Process::getExitCodeText