@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 57 lines 1.1 kB view raw
1<?php 2 3final class HarbormasterExecFuture 4 extends Future { 5 6 private $future; 7 private $stdout; 8 private $stderr; 9 10 public function setFuture(ExecFuture $future) { 11 $this->future = $future; 12 return $this; 13 } 14 15 public function getFuture() { 16 return $this->future; 17 } 18 19 public function setLogs( 20 HarbormasterBuildLog $stdout, 21 HarbormasterBuildLog $stderr) { 22 $this->stdout = $stdout; 23 $this->stderr = $stderr; 24 return $this; 25 } 26 27 public function isReady() { 28 if ($this->hasResult()) { 29 return true; 30 } 31 32 $future = $this->getFuture(); 33 34 $is_ready = $future->isReady(); 35 36 list($stdout, $stderr) = $future->read(); 37 $future->discardBuffers(); 38 39 if ($this->stdout) { 40 $this->stdout->append($stdout); 41 } 42 43 if ($this->stderr) { 44 $this->stderr->append($stderr); 45 } 46 47 if ($future->hasResult()) { 48 $this->setResult($future->getResult()); 49 } 50 51 // TODO: This should probably be implemented as a FutureProxy; it will 52 // not currently propagate exceptions or sockets properly. 53 54 return $is_ready; 55 } 56 57}