Changeset View
Changeset View
Standalone View
Standalone View
src/future/exec/PhutilExecPassthru.php
| Show All 14 Lines | |||||
| * | * | ||||
| * You can set the current working directory for the command with | * You can set the current working directory for the command with | ||||
| * @{method:setCWD}, and set the environment with @{method:setEnv}. | * @{method:setCWD}, and set the environment with @{method:setEnv}. | ||||
| * | * | ||||
| * @task command Executing Passthru Commands | * @task command Executing Passthru Commands | ||||
| */ | */ | ||||
| final class PhutilExecPassthru extends PhutilExecutableFuture { | final class PhutilExecPassthru extends PhutilExecutableFuture { | ||||
| private $passthruResult; | |||||
| /* -( Executing Passthru Commands )---------------------------------------- */ | /* -( Executing Passthru Commands )---------------------------------------- */ | ||||
| /** | /** | ||||
| * Execute this command. | * Execute this command. | ||||
| * | * | ||||
| * @return int Error code returned by the subprocess. | * @return int Error code returned by the subprocess. | ||||
| ▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | |||||
| /* -( Future )------------------------------------------------------------- */ | /* -( Future )------------------------------------------------------------- */ | ||||
| public function isReady() { | public function isReady() { | ||||
| // This isn't really a future because it executes synchronously and has | // This isn't really a future because it executes synchronously and has | ||||
| // full control of the console. We're just implementing the interfaces to | // full control of the console. We're just implementing the interfaces to | ||||
| // make it easier to share code with ExecFuture. | // make it easier to share code with ExecFuture. | ||||
| if ($this->passthruResult === null) { | if (!$this->hasResult()) { | ||||
| $this->passthruResult = $this->execute(); | $result = $this->execute(); | ||||
| $this->setResult($result); | |||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| protected function getResult() { | |||||
| return $this->passthruResult; | |||||
| } | |||||
| } | } | ||||