コード例 #1
0
 /**
  * Reads pipes, executes callback.
  *
  * @param bool $blocking Whether to use blocking calls or not.
  * @param bool $close    Whether to close file handles or not.
  */
 private function readPipes($blocking, $close)
 {
     $result = $this->processPipes->readAndWrite($blocking, $close);
     foreach ($result as $type => $data) {
         if (3 == $type) {
             $this->fallbackExitcode = (int) $data;
         } else {
             call_user_func($this->callback, $type === self::STDOUT ? self::OUT : self::ERR, $data);
         }
     }
 }
コード例 #2
0
ファイル: Process.php プロジェクト: MisatoTremor/symfony
 /**
  * Reads pipes, executes callback.
  *
  * @param bool $blocking Whether to use blocking calls or not.
  * @param bool $close    Whether to close file handles or not.
  */
 private function readPipes($blocking, $close)
 {
     $result = $this->processPipes->readAndWrite($blocking, $close);
     $callback = $this->callback;
     foreach ($result as $type => $data) {
         if (3 !== $type) {
             $callback($type === self::STDOUT ? self::OUT : self::ERR, $data);
         } elseif (!isset($this->fallbackStatus['signaled'])) {
             $this->fallbackStatus['exitcode'] = (int) $data;
         }
     }
 }
コード例 #3
0
ファイル: Process.php プロジェクト: NothingWeAre/symfony
 /**
  * Reads pipes, executes callback.
  *
  * @param bool $blocking Whether to use blocking calls or not.
  * @param bool $close    Whether to close file handles or not.
  */
 private function readPipes($blocking, $close)
 {
     $result = $this->processPipes->readAndWrite($blocking, $close);
     $callback = $this->callback;
     foreach ($result as $type => $data) {
         if (3 === $type) {
             foreach (explode("\n", substr($data, 0, -1)) as $data) {
                 if ('p' === $data[0]) {
                     $this->fallbackStatus['pid'] = (int) substr($data, 1);
                 } elseif ('s' === $data[0]) {
                     $this->fallbackStatus['signaled'] = true;
                     $this->fallbackStatus['exitcode'] = -1;
                     $this->fallbackStatus['termsig'] = (int) substr($data, 1);
                 } elseif ('x' === $data[0] && !isset($this->fallbackStatus['signaled'])) {
                     $this->fallbackStatus['exitcode'] = (int) substr($data, 1);
                 }
             }
         } else {
             $callback($type === self::STDOUT ? self::OUT : self::ERR, $data);
         }
     }
 }