• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ExecFuture类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ExecFuture的典型用法代码示例。如果您正苦于以下问题:PHP ExecFuture类的具体用法?PHP ExecFuture怎么用?PHP ExecFuture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ExecFuture类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Runs the test suite.
  */
 public function run()
 {
     $results = array();
     $command = '(mkdir -p build && cd build && cmake ..)';
     $command .= '&& make -C build all';
     $command .= '&& make -C build test';
     // Execute the test command & time it.
     $timeStart = microtime(true);
     $future = new ExecFuture($command);
     do {
         $future->read();
         sleep(0.5);
     } while (!$future->isReady());
     list($error, $stdout, $stderr) = $future->resolve();
     $timeEnd = microtime(true);
     // Create a unit test result structure.
     $result = new ArcanistUnitTestResult();
     $result->setNamespace('DerpVision');
     $result->setName('Core');
     $result->setDuration($timeEnd - $timeStart);
     if ($error == 0) {
         $result->setResult(ArcanistUnitTestResult::RESULT_PASS);
     } else {
         $result->setResult(ArcanistUnitTestResult::RESULT_FAIL);
         $result->setUserData($stdout . $stderr);
     }
     $results[] = $result;
     return $results;
 }
开发者ID:OpenRoomAlive,项目名称:OpenRoomAlive,代码行数:32,代码来源:UnitTestEngine.php


示例2: findMavenDirectories

 /**
  * Returns an array of the full canonical paths to all the Maven directories
  * (directories containing pom.xml files) in the project.
  */
 private function findMavenDirectories()
 {
     if (file_exists($this->project_root . "/.git")) {
         // The fastest way to find all the pom.xml files is to let git scan
         // its index.
         $future = new ExecFuture('git ls-files \\*/pom.xml');
     } else {
         // Not a git repo. Do it the old-fashioned way.
         $future = new ExecFuture('find . -name pom.xml -print');
     }
     // TODO: This will find *all* the pom.xml files in the working copy.
     // Need to obey the optional paths argument to "arc unit" to let users
     // run just a subset of tests.
     $future->setCWD($this->project_root);
     list($stdout) = $future->resolvex();
     $poms = explode("\n", trim($stdout));
     if (!$poms) {
         throw new Exception("No pom.xml files found");
     }
     $maven_dirs = array_map(function ($pom) {
         $maven_dir = dirname($pom);
         return realpath($this->project_root . '/' . $maven_dir);
     }, $poms);
     return $maven_dirs;
 }
开发者ID:betterworldtech,项目名称:arcanist,代码行数:29,代码来源:MavenTestEngine.php


示例3: runTests

 private function runTests()
 {
     $root = $this->getWorkingCopy()->getProjectRoot();
     $script = $this->getConfiguredScript();
     $path = $this->getConfiguredTestResultPath();
     foreach (glob($root . DIRECTORY_SEPARATOR . $path . "/*.xml") as $filename) {
         // Remove existing files so we cannot report old results
         $this->unlink($filename);
     }
     // Provide changed paths to process
     putenv("ARCANIST_DIFF_PATHS=" . implode(PATH_SEPARATOR, $this->getPaths()));
     $future = new ExecFuture('%C %s', $script, $path);
     $future->setCWD($root);
     $err = null;
     try {
         $future->resolvex();
     } catch (CommandException $exc) {
         $err = $exc;
     }
     $results = $this->parseTestResults($root . DIRECTORY_SEPARATOR . $path);
     if ($err) {
         $result = new ArcanistUnitTestResult();
         $result->setName('Unit Test Script');
         $result->setResult(ArcanistUnitTestResult::RESULT_BROKEN);
         $result->setUserData("ERROR: Command failed with code {$err->getError()}\nCOMMAND: `{$err->getCommand()}`");
         $results[] = $result;
     }
     return $results;
 }
开发者ID:eliksir,项目名称:disqus-arcanist,代码行数:29,代码来源:GenericXUnitTestEngine.php


示例4: lintPath

 public function lintPath($path)
 {
     $sbt = $this->getSBTPath();
     // Tell SBT to not use color codes so our regex life is easy.
     // TODO: Should this be "clean compile" instead of "compile"?
     $f = new ExecFuture("%s -Dsbt.log.noformat=true compile", $sbt);
     list($err, $stdout, $stderr) = $f->resolve();
     $lines = explode("\n", $stdout);
     $messages = array();
     foreach ($lines as $line) {
         $matches = null;
         if (!preg_match("/\\[(warn|error)\\] (.*?):(\\d+): (.*?)\$/", $line, $matches)) {
             continue;
         }
         foreach ($matches as $key => $match) {
             $matches[$key] = trim($match);
         }
         $message = new ArcanistLintMessage();
         $message->setPath($matches[2]);
         $message->setLine($matches[3]);
         $message->setCode($this->getLinterName());
         $message->setDescription($matches[4]);
         $message->setSeverity($this->getMessageCodeSeverity($matches[1]));
         $this->addLintMessage($message);
     }
 }
开发者ID:chaozhang80,项目名称:tool-package,代码行数:26,代码来源:ArcanistScalaSBTLinter.php


示例5: lintPath

 public function lintPath($path)
 {
     $working_copy = $this->getEngine()->getWorkingCopy();
     $pyflakes_path = $working_copy->getConfig('lint.pyflakes.path');
     $pyflakes_prefix = $working_copy->getConfig('lint.pyflakes.prefix');
     // Default to just finding pyflakes in the users path
     $pyflakes_bin = 'pyflakes';
     $python_path = '';
     // If a pyflakes path was specified, then just use that as the
     // pyflakes binary and assume that the libraries will be imported
     // correctly.
     //
     // If no pyflakes path was specified and a pyflakes prefix was
     // specified, then use the binary from this prefix and add it to
     // the PYTHONPATH environment variable so that the libs are imported
     // correctly.  This is useful when pyflakes is installed into a
     // non-default location.
     if ($pyflakes_path !== null) {
         $pyflakes_bin = $pyflakes_path;
     } else {
         if ($pyflakes_prefix !== null) {
             $pyflakes_bin = $pyflakes_prefix . '/bin/pyflakes';
             $python_path = $pyflakes_prefix . '/lib/python2.6/site-packages:';
         }
     }
     $options = $this->getPyFlakesOptions();
     $f = new ExecFuture("/usr/bin/env PYTHONPATH=%s\$PYTHONPATH " . "{$pyflakes_bin} {$options}", $python_path);
     $f->write($this->getData($path));
     try {
         list($stdout, $_) = $f->resolvex();
     } catch (CommandException $e) {
         // PyFlakes will return an exit code of 1 if warnings/errors
         // are found but print nothing to stderr in this case.  Therefore,
         // if we see any output on stderr or a return code other than 1 or 0,
         // pyflakes failed.
         if ($e->getError() !== 1 || $e->getStderr() !== '') {
             throw $e;
         } else {
             $stdout = $e->getStdout();
         }
     }
     $lines = explode("\n", $stdout);
     $messages = array();
     foreach ($lines as $line) {
         $matches = null;
         if (!preg_match('/^(.*?):(\\d+): (.*)$/', $line, $matches)) {
             continue;
         }
         foreach ($matches as $key => $match) {
             $matches[$key] = trim($match);
         }
         $message = new ArcanistLintMessage();
         $message->setPath($path);
         $message->setLine($matches[2]);
         $message->setCode($this->getLinterName());
         $message->setDescription($matches[3]);
         $message->setSeverity(ArcanistLintSeverity::SEVERITY_WARNING);
         $this->addLintMessage($message);
     }
 }
开发者ID:nik-kor,项目名称:arcanist,代码行数:60,代码来源:ArcanistPyFlakesLinter.php


示例6: lintPath

 public function lintPath($path)
 {
     $bin = $this->getLintPath();
     $path = $this->rocksdbDir() . '/' . $path;
     $f = new ExecFuture("%C {$path}", $bin);
     list($err, $stdout, $stderr) = $f->resolve();
     if ($err === 2) {
         throw new Exception("cpplint failed to run correctly:\n" . $stderr);
     }
     $lines = explode("\n", $stderr);
     $messages = array();
     foreach ($lines as $line) {
         $line = trim($line);
         $matches = null;
         $regex = '/^[^:]+:(\\d+):\\s*(.*)\\s*\\[(.*)\\] \\[(\\d+)\\]$/';
         if (!preg_match($regex, $line, $matches)) {
             continue;
         }
         foreach ($matches as $key => $match) {
             $matches[$key] = trim($match);
         }
         $message = new ArcanistLintMessage();
         $message->setPath($path);
         $message->setLine($matches[1]);
         $message->setCode($matches[3]);
         $message->setName($matches[3]);
         $message->setDescription($matches[2]);
         $message->setSeverity(ArcanistLintSeverity::SEVERITY_WARNING);
         $this->addLintMessage($message);
     }
 }
开发者ID:michaelsuo,项目名称:rocksdb,代码行数:31,代码来源:ArcanistCpplintLinter.php


示例7: lintPath

 public function lintPath($path)
 {
     $rubyp = $this->getRubyPath();
     $f = new ExecFuture("%s -wc", $rubyp);
     $f->write($this->getData($path));
     list($err, $stdout, $stderr) = $f->resolve();
     if ($err === 0) {
         return;
     }
     $lines = explode("\n", $stderr);
     $messages = array();
     foreach ($lines as $line) {
         $matches = null;
         if (!preg_match("/(.*?):(\\d+): (.*?)\$/", $line, $matches)) {
             continue;
         }
         foreach ($matches as $key => $match) {
             $matches[$key] = trim($match);
         }
         $code = head(explode(',', $matches[3]));
         $message = new ArcanistLintMessage();
         $message->setPath($path);
         $message->setLine($matches[2]);
         $message->setName($this->getLinterName() . " " . $code);
         $message->setDescription($matches[3]);
         $message->setSeverity($this->getMessageCodeSeverity($code));
         $this->addLintMessage($message);
     }
 }
开发者ID:chaozhang80,项目名称:tool-package,代码行数:29,代码来源:ArcanistRubyLinter.php


示例8: ctags_check_executable

function ctags_check_executable()
{
    $future = new ExecFuture('ctags --version');
    $result = $future->resolve();
    if (empty($result[1])) {
        return false;
    }
    return true;
}
开发者ID:nexeck,项目名称:phabricator,代码行数:9,代码来源:generate_ctags_symbols.php


示例9: xhpast_get_parser_future

/**
 * @group xhpast
 */
function xhpast_get_parser_future($data)
{
    if (!xhpast_is_available()) {
        throw new Exception(xhpast_get_build_instructions());
    }
    $future = new ExecFuture('%s', xhpast_get_binary_path());
    $future->write($data);
    return $future;
}
开发者ID:chaozhang80,项目名称:tool-package,代码行数:12,代码来源:xhpast_parse.php


示例10: __construct

 /**
  * Construct an exec channel from a @{class:ExecFuture}. The future should
  * **NOT** have been started yet (e.g., with `isReady()` or `start()`),
  * because @{class:ExecFuture} closes stdin by default when futures start.
  * If stdin has been closed, you will be unable to write on the channel.
  *
  * @param ExecFuture Future to use as an underlying I/O source.
  * @task construct
  */
 public function __construct(ExecFuture $future)
 {
     // Make an empty write to keep the stdin pipe open. By default, futures
     // close this pipe when they start.
     $future->write('', $keep_pipe = true);
     // Start the future so that reads and writes work immediately.
     $future->isReady();
     $this->future = $future;
 }
开发者ID:chaozhang80,项目名称:tool-package,代码行数:18,代码来源:PhutilExecChannel.php


示例11: testTimeoutTestShouldRunLessThan1Sec

 public function testTimeoutTestShouldRunLessThan1Sec()
 {
     // NOTE: This is partly testing that we choose appropriate select wait
     // times; this test should run for significantly less than 1 second.
     $future = new ExecFuture('sleep 32000');
     list($err) = $future->setTimeout(0.01)->resolve();
     $this->assertEqual(true, $err > 0);
     $this->assertEqual(true, $future->getWasKilledByTimeout());
 }
开发者ID:rwray,项目名称:libphutil,代码行数:9,代码来源:ExecFutureTestCase.php


示例12: writeAndRead

 private function writeAndRead($write, $read)
 {
     $future = new ExecFuture('cat');
     $future->write($write);
     $lines = array();
     foreach (new LinesOfALargeExecFuture($future) as $line) {
         $lines[] = $line;
     }
     $this->assertEqual($read, $lines, pht('Write: %s', id(new PhutilUTF8StringTruncator())->setMaximumGlyphs(32)->truncateString($write)));
 }
开发者ID:barcelonascience,项目名称:libphutil,代码行数:10,代码来源:LinesOfALargeExecFutureTestCase.php


示例13: configureFuture

 protected function configureFuture(ExecFuture $future)
 {
     if ($this->getTimeout()) {
         $future->setTimeout($this->getTimeout());
     }
     if ($this->getByteLimit()) {
         $future->setStdoutSizeLimit($this->getByteLimit());
         $future->setStderrSizeLimit($this->getByteLimit());
     }
 }
开发者ID:pugong,项目名称:phabricator,代码行数:10,代码来源:DiffusionRawDiffQuery.php


示例14: writeAndRead

 private function writeAndRead($write, $read)
 {
     $future = new ExecFuture('cat');
     $future->write($write);
     $lines = array();
     foreach (new LinesOfALargeExecFuture($future) as $line) {
         $lines[] = $line;
     }
     $this->assertEqual($read, $lines, "Write: " . phutil_utf8_shorten($write, 32));
 }
开发者ID:jasteele12,项目名称:prb_lint_tests,代码行数:10,代码来源:LinesOfALargeExecFutureTestCase.php


示例15: buildTestFuture

 public function buildTestFuture($junit_tmp, $cover_tmp)
 {
     $paths = $this->getPaths();
     $config_manager = $this->getConfigurationManager();
     $coverage_command = $config_manager->getConfigFromAnySource('unit.golang.command');
     $cmd_line = csprintf($coverage_command, $junit_tmp, $cover_tmp);
     $future = new ExecFuture('%C', $cmd_line);
     $future->setCWD($this->projectRoot);
     return $future;
 }
开发者ID:rmaz,项目名称:arcanist,代码行数:10,代码来源:ConfigurableGolangTestEngine.php


示例16: testNoHangOnExecFutureDestructionWithRunningChild

 public function testNoHangOnExecFutureDestructionWithRunningChild()
 {
     $start = microtime(true);
     $future = new ExecFuture('sleep 30');
     $future->start();
     unset($future);
     $end = microtime(true);
     // If ExecFuture::__destruct() hangs until the child closes, we won't make
     // it here in time.
     $this->assertEqual(true, $end - $start < 5);
 }
开发者ID:chaozhang80,项目名称:tool-package,代码行数:11,代码来源:ExecFutureTestCase.php


示例17: runBootloaderTests

 private function runBootloaderTests(PhageAgentBootloader $boot)
 {
     $name = get_class($boot);
     $exec = new ExecFuture('%C', $boot->getBootCommand());
     $exec->write($boot->getBootSequence(), $keep_open = true);
     $exec_channel = new PhutilExecChannel($exec);
     $agent = new PhutilJSONProtocolChannel($exec_channel);
     $agent->write(array('type' => 'EXEC', 'key' => 1, 'command' => 'echo phage'));
     $this->agentExpect($agent, array('type' => 'RSLV', 'key' => 1, 'err' => 0, 'stdout' => "phage\n", 'stderr' => ''), "'echo phage' for {$name}");
     $agent->write(array('type' => 'EXIT'));
 }
开发者ID:chaozhang80,项目名称:tool-package,代码行数:11,代码来源:PhageAgentTestCase.php


示例18: willLintPaths

 public function willLintPaths(array $paths)
 {
     $working_copy = $this->getEngine()->getWorkingCopy();
     $root = $working_copy->getProjectRoot();
     $chunks = array_chunk($paths, 8);
     foreach ($chunks as $chunk) {
         $f = new ExecFuture("python %C --root=include --filter=-build/include_order " . "--verbose=2 %Ls", $root . '/thirdparty/cpplint.py', $chunk);
         $f->start();
         $this->futures[] = $f;
     }
 }
开发者ID:colindj,项目名称:libphenom,代码行数:11,代码来源:PhenomCLinter.php


示例19: getHighlightFuture

 public function getHighlightFuture($source)
 {
     $language = idx($this->config, 'language');
     if ($language) {
         $language = $this->getPygmentsLexerNameFromLanguageName($language);
         $future = new ExecFuture('pygmentize -O stripnl=False -f html -l %s', $language);
         $future->write($source);
         return new PhutilDefaultSyntaxHighlighterEnginePygmentsFuture($future, $source);
     }
     return id(new PhutilDefaultSyntaxHighlighter())->getHighlightFuture($source);
 }
开发者ID:rmoorman,项目名称:libphutil,代码行数:11,代码来源:PhutilPygmentsSyntaxHighlighter.php


示例20: run

 public function run()
 {
     $command = $this->getConfigurationManager()->getConfigFromAnySource('unit.engine.tap.command');
     $future = new ExecFuture($command);
     do {
         list($stdout, $stderr) = $future->read();
         echo $stdout;
         echo $stderr;
         sleep(0.5);
     } while (!$future->isReady());
     list($error, $stdout, $stderr) = $future->resolve();
     return $this->parseOutput($stdout);
 }
开发者ID:mdesanti,项目名称:arcanist-extensions,代码行数:13,代码来源:TAPTestEngine.php



注:本文中的ExecFuture类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Executor类代码示例发布时间:2022-05-23
下一篇:
PHP ExceptionHandler类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap