Changeset View
Changeset View
Standalone View
Standalone View
src/future/exec/ExecFuture.php
| Show First 20 Lines • Show All 188 Lines • ▼ Show 20 Lines | public function read() { | ||||
| $this->stderrPos = strlen($this->stderr); | $this->stderrPos = strlen($this->stderr); | ||||
| return $result; | return $result; | ||||
| } | } | ||||
| public function readStdout() { | public function readStdout() { | ||||
| if ($this->start) { | if ($this->start) { | ||||
| $this->isReady(); // Sync | $this->updateFuture(); // Sync | ||||
| } | } | ||||
| $result = (string)substr($this->stdout, $this->stdoutPos); | $result = (string)substr($this->stdout, $this->stdoutPos); | ||||
| $this->stdoutPos = strlen($this->stdout); | $this->stdoutPos = strlen($this->stdout); | ||||
| return $result; | return $result; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 679 Lines • ▼ Show 20 Lines | private function procGetStatus() { | ||||
| // After the process exits, we only get one chance to read proc_get_status() | // After the process exits, we only get one chance to read proc_get_status() | ||||
| // before it starts returning garbage. Make sure we don't throw away the | // before it starts returning garbage. Make sure we don't throw away the | ||||
| // last good read. | // last good read. | ||||
| if ($this->procStatus) { | if ($this->procStatus) { | ||||
| if (!$this->procStatus['running']) { | if (!$this->procStatus['running']) { | ||||
| return $this->procStatus; | return $this->procStatus; | ||||
| } | } | ||||
| } | } | ||||
| // See T13555. This may occur if you call "getPID()" on a future which | |||||
| // exited immediately without ever creating a valid subprocess. | |||||
| if (!$this->proc) { | |||||
| throw new Exception( | |||||
| pht( | |||||
| 'Attempting to get subprocess status in "ExecFuture" with no '. | |||||
| 'valid subprocess.')); | |||||
| } | |||||
| $this->procStatus = proc_get_status($this->proc); | $this->procStatus = proc_get_status($this->proc); | ||||
| return $this->procStatus; | return $this->procStatus; | ||||
| } | } | ||||
| /** | /** | ||||
| * Try to close stdin, if we're done using it. This keeps us from hanging if | * Try to close stdin, if we're done using it. This keeps us from hanging if | ||||
| * the process on the other end of the pipe is waiting for EOF. | * the process on the other end of the pipe is waiting for EOF. | ||||
| ▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines | |||||