launchProcess() public method

Launches a process in the foreground.
public launchProcess ( string $command, array $arguments = [], boolean $killable = true ) : integer
$command string The command to execute.
$arguments array Arguments to be quoted and inserted into the command. Each key "key" in the array should correspond to a placeholder "%key%" in the command.
$killable boolean Whether the process can be killed by the user.
return integer The exit status of the process.
Ejemplo n.º 1
0
 public function testLaunchWithError()
 {
     if (!$this->php) {
         $this->markTestSkipped('The "bash" binary is not available.');
         return;
     }
     if (!function_exists('proc_open')) {
         $this->markTestSkipped('The "proc_open" function is not available.');
         return;
     }
     $status = $this->launcher->launchProcess($this->php . ' -r %command%', array('command' => 'exit(123);'));
     $this->assertSame(123, $status);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function handle()
 {
     if (!$this->processLauncher->isSupported()) {
         throw new RuntimeException('The ProcessLauncher must be supported for the man help to run.');
     }
     if (!$this->manBinary) {
         $this->manBinary = $this->executableFinder->find('man');
     }
     if (!$this->manBinary) {
         throw new RuntimeException('The "man" binary was not found.');
     }
     return $this->processLauncher->launchProcess(escapeshellcmd($this->manBinary) . ' -l %path%', array('path' => $this->path), false);
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function handle(Args $args, IO $io)
 {
     if ($this->processLauncher->isSupported()) {
         if (!$this->lessBinary) {
             $this->lessBinary = $this->executableFinder->find('less');
         }
         if ($this->lessBinary) {
             return $this->processLauncher->launchProcess(escapeshellcmd($this->lessBinary) . ' %path%', array('path' => $this->path), false);
         }
     }
     $io->write(file_get_contents($this->path));
     return 0;
 }