resolve() public méthode

public resolve ( $value )
Exemple #1
0
 private function resolveFuture($key, Future $future)
 {
     $result = $future->resolve();
     $master = $this->getMaster();
     $master->write(array('type' => 'RSLV', 'key' => $key, 'err' => $result[0], 'stdout' => $result[1], 'stderr' => $result[2]));
     unset($this->exec[$key]);
 }
 protected function resolveFuture($path, Future $future)
 {
     list($rc, $stdout) = $future->resolve();
     $lines = explode("\n", $stdout);
     $messages = array();
     foreach ($lines as $line) {
         $matches = null;
         if (!preg_match('/^(.*?):(\\d+):(\\d+): (\\S+) (.*)$/', $line, $matches)) {
             continue;
         }
         foreach ($matches as $key => $match) {
             $matches[$key] = trim($match);
         }
         if (!$this->isMessageEnabled($matches[4])) {
             continue;
         }
         $message = new ArcanistLintMessage();
         $message->setPath($path);
         $message->setLine($matches[2]);
         $message->setChar($matches[3]);
         $message->setCode($matches[4]);
         $message->setName('PEP8 ' . $matches[4]);
         $message->setDescription($matches[5]);
         $message->setSeverity(ArcanistLintSeverity::SEVERITY_WARNING);
         $this->addLintMessage($message);
     }
 }
 protected final function resolveFuture($path, Future $future)
 {
     list($err, $stdout, $stderr) = $future->resolve();
     if ($err) {
         $future->resolvex();
     }
     $messages = $this->parseLinterOutput($path, $err, $stdout, $stderr);
     if ($messages === false) {
         if ($err) {
             $future->resolvex();
         } else {
             throw new Exception(sprintf("%s\n\nSTDOUT\n%s\n\nSTDERR\n%s", pht('Linter failed to parse output!'), $stdout, $stderr));
         }
     }
     foreach ($messages as $message) {
         $this->addLintMessage($message);
     }
 }
Exemple #4
0
 /**
  * {@inheritdoc}
  */
 public function resolve($value = null)
 {
     parent::resolve($value);
 }
Exemple #5
0
 /**
  * {@inheritdoc}
  */
 protected function resolve($value = null)
 {
     parent::resolve($value);
     $this->generator = null;
     $this->current = null;
     $this->send = null;
     $this->capture = null;
 }
 protected function resolveFuture(HarbormasterBuild $build, HarbormasterBuildTarget $target, Future $future)
 {
     $futures = new FutureIterator(array($future));
     foreach ($futures->setUpdateInterval(5) as $key => $future) {
         if ($future === null) {
             $build->reload();
             if ($this->shouldAbort($build, $target)) {
                 throw new HarbormasterBuildAbortedException();
             }
         } else {
             return $future->resolve();
         }
     }
 }
Exemple #7
0
 /**
  * Resolve a command, returning its exit code, stdout, and stderr. See also
  * @{function:exec_manual}. For stronger error-checking behavior, see
  * @{method:resolvex} and @{method:resolveJSON}.
  *
  *   list($err, $stdout, $stderr) = $future->resolve();
  *
  * @param  float Optional timeout after which resolution will pause and
  *               execution will return to the caller.
  * @return list  <$err, $stdout, $stderr> list.
  * @task resolve
  */
 public function resolve($timeout = null)
 {
     if (null === $timeout) {
         $timeout = $this->timeout;
     }
     return parent::resolve($timeout);
 }
 protected final function resolveFuture($path, Future $future)
 {
     list($err, $stdout, $stderr) = $future->resolve();
     if ($err && !$this->shouldExpectCommandErrors()) {
         $future->resolvex();
     }
     $messages = $this->parseLinterOutput($path, $err, $stdout, $stderr);
     if ($err && $this->shouldExpectCommandErrors() && !$messages) {
         // We assume that if the future exits with a non-zero status and we
         // failed to parse any linter messages, then something must've gone wrong
         // during parsing.
         $messages = false;
     }
     if ($messages === false) {
         if ($err) {
             $future->resolvex();
         } else {
             throw new Exception(sprintf("%s\n\nSTDOUT\n%s\n\nSTDERR\n%s", pht('Linter failed to parse output!'), $stdout, $stderr));
         }
     }
     foreach ($messages as $message) {
         $this->addLintMessage($message);
     }
 }
 protected final function resolveFuture($path, Future $future)
 {
     list($err, $stdout, $stderr) = $future->resolve();
     if ($err && !$this->shouldExpectCommandErrors()) {
         $future->resolvex();
     }
     $messages = $this->parseLinterOutput($path, $err, $stdout, $stderr);
     if ($messages === false) {
         if ($err) {
             $future->resolvex();
         } else {
             throw new Exception("Linter failed to parse output!\n\n{$stdout}\n\n{$stderr}");
         }
     }
     foreach ($messages as $message) {
         $this->addLintMessage($message);
     }
 }
Exemple #10
0
function settle($array)
{
    return toFuture($array)->then(function ($array) {
        $keys = array_keys($array);
        $n = count($array);
        $result = array();
        if ($n === 0) {
            return value($result);
        }
        $future = new Future();
        $oncomplete = function ($index, $f) use($future, &$result, &$n, $keys) {
            return function () use($index, $f, $future, &$result, &$n, $keys) {
                $result[$index] = $f->inspect();
                if (--$n === 0) {
                    $array = array();
                    foreach ($keys as $key) {
                        $array[$key] = $result[$key];
                    }
                    $future->resolve($array);
                }
            };
        };
        foreach ($array as $index => $element) {
            $f = toFuture($element);
            $f->whenComplete($oncomplete($index, $f));
        }
        return $future;
    });
}
Exemple #11
0
 protected function resolveFuture($package, Future $future)
 {
     list($err, $stdout, $stderr) = $future->resolve();
     $parser = new ArcanistGoTestResultParser();
     $messages = $parser->parseTestResults($package, $stdout, $stderr);
     if ($messages === false) {
         if ($err) {
             $future->resolvex();
         } else {
             throw new Exception(sprintf("%s\n\nSTDOUT\n%s\n\nSTDERR\n%s", pht('GoTestEngine failed to parse result!'), $stdout, $stderr));
         }
     }
     return $messages;
 }