Path: blob/master/src/applications/harbormaster/future/HarbormasterExecFuture.php
12256 views
<?php12final class HarbormasterExecFuture3extends Future {45private $future;6private $stdout;7private $stderr;89public function setFuture(ExecFuture $future) {10$this->future = $future;11return $this;12}1314public function getFuture() {15return $this->future;16}1718public function setLogs(19HarbormasterBuildLog $stdout,20HarbormasterBuildLog $stderr) {21$this->stdout = $stdout;22$this->stderr = $stderr;23return $this;24}2526public function isReady() {27if ($this->hasResult()) {28return true;29}3031$future = $this->getFuture();3233$is_ready = $future->isReady();3435list($stdout, $stderr) = $future->read();36$future->discardBuffers();3738if ($this->stdout) {39$this->stdout->append($stdout);40}4142if ($this->stderr) {43$this->stderr->append($stderr);44}4546if ($future->hasResult()) {47$this->setResult($future->getResult());48}4950// TODO: This should probably be implemented as a FutureProxy; it will51// not currently propagate exceptions or sockets properly.5253return $is_ready;54}5556}575859