当前位置: 首页>>代码示例>>PHP>>正文


PHP exec_manual函数代码示例

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


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

示例1: getPEP8Path

 public function getPEP8Path()
 {
     $working_copy = $this->getEngine()->getWorkingCopy();
     $prefix = $working_copy->getConfig('lint.pep8.prefix');
     $bin = $working_copy->getConfig('lint.pep8.bin');
     if ($bin === null && $prefix === null) {
         $bin = csprintf('/usr/bin/env python2.6 %s', phutil_get_library_root('arcanist') . '/../externals/pep8/pep8.py');
     } else {
         if ($bin === null) {
             $bin = 'pep8';
         }
         if ($prefix !== null) {
             if (!Filesystem::pathExists($prefix . '/' . $bin)) {
                 throw new ArcanistUsageException("Unable to find PEP8 binary in a specified directory. Make sure " . "that 'lint.pep8.prefix' and 'lint.pep8.bin' keys are set " . "correctly. If you'd rather use a copy of PEP8 installed " . "globally, you can just remove these keys from your .arcconfig.");
             }
             $bin = csprintf("%s/%s", $prefix, $bin);
             return $bin;
         }
         // Look for globally installed PEP8
         list($err) = exec_manual('which %s', $bin);
         if ($err) {
             throw new ArcanistUsageException("PEP8 does not appear to be installed on this system. Install it " . "(e.g., with 'easy_install pep8') or configure " . "'lint.pep8.prefix' in your .arcconfig to point to the directory " . "where it resides.");
         }
     }
     return $bin;
 }
开发者ID:chaozhang80,项目名称:tool-package,代码行数:26,代码来源:ArcanistPEP8Linter.php

示例2: newAPIFromWorkingCopyIdentity

 public static function newAPIFromWorkingCopyIdentity(ArcanistWorkingCopyIdentity $working_copy)
 {
     $root = $working_copy->getProjectRoot();
     if (!$root) {
         throw new ArcanistUsageException("There is no readable '.arcconfig' file in the working directory or " . "any parent directory. Create an '.arcconfig' file to configure arc.");
     }
     // check if we're in an svn working copy
     list($err) = exec_manual('svn info');
     if (!$err) {
         $api = newv('ArcanistSubversionAPI', array($root));
         $api->workingCopyIdentity = $working_copy;
         return $api;
     }
     if (Filesystem::pathExists($root . '/.hg')) {
         $api = newv('ArcanistMercurialAPI', array($root));
         $api->workingCopyIdentity = $working_copy;
         return $api;
     }
     $git_root = self::discoverGitBaseDirectory($root);
     if ($git_root) {
         if (!Filesystem::pathsAreEquivalent($root, $git_root)) {
             throw new ArcanistUsageException("'.arcconfig' file is located at '{$root}', but working copy root " . "is '{$git_root}'. Move '.arcconfig' file to the working copy root.");
         }
         $api = newv('ArcanistGitAPI', array($root));
         $api->workingCopyIdentity = $working_copy;
         return $api;
     }
     throw new ArcanistUsageException("The current working directory is not part of a working copy for a " . "supported version control system (svn, git or mercurial).");
 }
开发者ID:nik-kor,项目名称:arcanist,代码行数:29,代码来源:ArcanistRepositoryAPI.php

示例3: lintPath

 public function lintPath($path)
 {
     $pep8_bin = $this->getPEP8Path();
     $options = $this->getPEP8Options();
     list($rc, $stdout) = exec_manual("%C %C %s", $pep8_bin, $options, $this->getEngine()->getFilePathOnDisk($path));
     $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);
         }
         $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]);
         if (!$this->isMessageEnabled($matches[4])) {
             continue;
         }
         if ($matches[4][0] == 'E') {
             $message->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR);
         } else {
             $message->setSeverity(ArcanistLintSeverity::SEVERITY_WARNING);
         }
         $this->addLintMessage($message);
     }
 }
开发者ID:nik-kor,项目名称:arcanist,代码行数:33,代码来源:ArcanistPEP8Linter.php

示例4: phutil_console_prompt

/**
 * @group console
 */
function phutil_console_prompt($prompt, $history = '')
{
    echo "\n\n";
    $prompt = phutil_console_wrap($prompt . ' ', 4);
    try {
        phutil_console_require_tty();
    } catch (PhutilConsoleStdinNotInteractiveException $ex) {
        // Throw after echoing the prompt so the user has some idea what happened.
        echo $prompt;
        throw $ex;
    }
    $use_history = true;
    if ($history == '') {
        $use_history = false;
    } else {
        // Test if bash is available by seeing if it can run `true`.
        list($err) = exec_manual('bash -c %s', 'true');
        if ($err) {
            $use_history = false;
        }
    }
    if (!$use_history) {
        echo $prompt;
        $response = fgets(STDIN);
    } else {
        // There's around 0% chance that readline() is available directly in PHP,
        // so we're using bash/read/history instead.
        $command = csprintf('bash -c %s', csprintf('history -r %s 2>/dev/null; ' . 'read -e -p %s; ' . 'echo "$REPLY"; ' . 'history -s "$REPLY" 2>/dev/null; ' . 'history -w %s 2>/dev/null', $history, $prompt, $history));
        // execx() doesn't work with input, phutil_passthru() doesn't return output.
        $response = shell_exec($command);
    }
    return rtrim($response, "\r\n");
}
开发者ID:relrod,项目名称:libphutil,代码行数:36,代码来源:format.php

示例5: executeChecks

 protected function executeChecks()
 {
     if (phutil_is_windows()) {
         $bin_name = 'where';
     } else {
         $bin_name = 'which';
     }
     if (!Filesystem::binaryExists($bin_name)) {
         $message = pht("Without '%s', Phabricator can not test for the availability " . "of other binaries.", $bin_name);
         $this->raiseWarning($bin_name, $message);
         // We need to return here if we can't find the 'which' / 'where' binary
         // because the other tests won't be valid.
         return;
     }
     if (!Filesystem::binaryExists('diff')) {
         $message = pht("Without 'diff', Phabricator will not be able to generate or render " . "diffs in multiple applications.");
         $this->raiseWarning('diff', $message);
     } else {
         $tmp_a = new TempFile();
         $tmp_b = new TempFile();
         $tmp_c = new TempFile();
         Filesystem::writeFile($tmp_a, 'A');
         Filesystem::writeFile($tmp_b, 'A');
         Filesystem::writeFile($tmp_c, 'B');
         list($err) = exec_manual('diff %s %s', $tmp_a, $tmp_b);
         if ($err) {
             $this->newIssue('bin.diff.same')->setName(pht("Unexpected 'diff' Behavior"))->setMessage(pht("The 'diff' binary on this system has unexpected behavior: " . "it was expected to exit without an error code when passed " . "identical files, but exited with code %d.", $err));
         }
         list($err) = exec_manual('diff %s %s', $tmp_a, $tmp_c);
         if (!$err) {
             $this->newIssue('bin.diff.diff')->setName(pht("Unexpected 'diff' Behavior"))->setMessage(pht("The 'diff' binary on this system has unexpected behavior: " . "it was expected to exit with a nonzero error code when passed " . "differing files, but did not."));
         }
     }
     $table = new PhabricatorRepository();
     $vcses = queryfx_all($table->establishConnection('r'), 'SELECT DISTINCT versionControlSystem FROM %T', $table->getTableName());
     foreach ($vcses as $vcs) {
         switch ($vcs['versionControlSystem']) {
             case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
                 $binary = 'git';
                 break;
             case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
                 $binary = 'svn';
                 break;
             case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
                 $binary = 'hg';
                 break;
             default:
                 $binary = null;
                 break;
         }
         if (!$binary) {
             continue;
         }
         if (!Filesystem::binaryExists($binary)) {
             $message = pht('You have at least one repository configured which uses this ' . 'version control system. It will not work without the VCS binary.');
             $this->raiseWarning($binary, $message);
         }
     }
 }
开发者ID:denghp,项目名称:phabricator,代码行数:59,代码来源:PhabricatorSetupCheckBinaries.php

示例6: getBinaryPath

 private function getBinaryPath()
 {
     if ($this->symbolsBinary === null) {
         list($err, $stdout) = exec_manual('which javelinsymbols');
         $this->symbolsBinary = $err ? false : rtrim($stdout);
     }
     return $this->symbolsBinary;
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:8,代码来源:PhabricatorJavelinLinter.php

示例7: generateRawDiffFromFileContent

 /**
  * Generate a raw diff from two raw files. This is a lower-level API than
  * @{method:generateChangesetFromFileContent}, but may be useful if you need
  * to use a custom parser configuration, as with Diffusion.
  *
  * @param string Entire previous file content.
  * @param string Entire current file content.
  * @return string Raw diff between the two files.
  * @task diff
  */
 public function generateRawDiffFromFileContent($old, $new)
 {
     $options = array();
     if ($this->ignoreWhitespace) {
         $options[] = '-bw';
     }
     // Generate diffs with full context.
     $options[] = '-U65535';
     $old_name = nonempty($this->oldName, '/dev/universe') . ' 9999-99-99';
     $new_name = nonempty($this->newName, '/dev/universe') . ' 9999-99-99';
     $options[] = '-L';
     $options[] = $old_name;
     $options[] = '-L';
     $options[] = $new_name;
     $old_tmp = new TempFile();
     $new_tmp = new TempFile();
     Filesystem::writeFile($old_tmp, $old);
     Filesystem::writeFile($new_tmp, $new);
     list($err, $diff) = exec_manual('diff %Ls %s %s', $options, $old_tmp, $new_tmp);
     if (!$err) {
         // This indicates that the two files are the same (or, possibly, the
         // same modulo whitespace differences, which is why we can't do this
         // check trivially before running `diff`). Build a synthetic, changeless
         // diff so that we can still render the raw, unchanged file instead of
         // being forced to just say "this file didn't change" since we don't have
         // the content.
         $entire_file = explode("\n", $old);
         foreach ($entire_file as $k => $line) {
             $entire_file[$k] = ' ' . $line;
         }
         $len = count($entire_file);
         $entire_file = implode("\n", $entire_file);
         // TODO: If both files were identical but missing newlines, we probably
         // get this wrong. Unclear if it ever matters.
         // This is a bit hacky but the diff parser can handle it.
         $diff = "--- {$old_name}\n" . "+++ {$new_name}\n" . "@@ -1,{$len} +1,{$len} @@\n" . $entire_file . "\n";
     } else {
         if ($this->ignoreWhitespace) {
             // Under "-bw", `diff` is inconsistent about emitting "\ No newline
             // at end of file". For instance, a long file with a change in the
             // middle will emit a contextless "\ No newline..." at the end if a
             // newline is removed, but not if one is added. A file with a change
             // at the end will emit the "old" "\ No newline..." block only, even
             // if the newline was not removed. Since we're ostensibly ignoring
             // whitespace changes, just drop these lines if they appear anywhere
             // in the diff.
             $lines = explode("\n", $diff);
             foreach ($lines as $key => $line) {
                 if (isset($line[0]) && $line[0] == '\\') {
                     unset($lines[$key]);
                 }
             }
             $diff = implode("\n", $lines);
         }
     }
     return $diff;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:67,代码来源:PhabricatorDifferenceEngine.php

示例8: getControlDirectory

 private function getControlDirectory($path)
 {
     if (!Filesystem::pathExists($path)) {
         list($err) = exec_manual('mkdir -p %s', $path);
         if ($err) {
             throw new Exception(pht("%s requires the directory '%s' to exist, but it does not exist " . "and could not be created. Create this directory or update " . "'%s' / '%s' in your configuration to point to an existing " . "directory.", 'phd', $path, 'phd.pid-directory', 'phd.log-directory'));
         }
     }
     return $path;
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:10,代码来源:PhabricatorDaemonManagementWorkflow.php

示例9: getControlDirectory

 private function getControlDirectory($path)
 {
     if (!Filesystem::pathExists($path)) {
         list($err) = exec_manual('mkdir -p %s', $path);
         if ($err) {
             throw new Exception("phd requires the directory '{$path}' to exist, but it does not " . "exist and could not be created. Create this directory or update " . "'phd.pid-directory' / 'phd.log-directory' in your configuration " . "to point to an existing directory.");
         }
     }
     return $path;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:10,代码来源:PhabricatorDaemonManagementWorkflow.php

示例10: getVersion

 public function getVersion()
 {
     // NOTE: `jsonlint --version` returns a non-zero exit status.
     list($err, $stdout) = exec_manual('%C --version', $this->getExecutableCommand());
     $matches = array();
     if (preg_match('/^(?P<version>\\d+\\.\\d+\\.\\d+)$/', $stdout, $matches)) {
         return $matches['version'];
     } else {
         return false;
     }
 }
开发者ID:lewisf,项目名称:arcanist,代码行数:11,代码来源:ArcanistJSONLintLinter.php

示例11: renderDifferences

 public static function renderDifferences($old, $new, $context_lines = 3, $diff_options = "-L 'Old Value' -L 'New Value'")
 {
     if ((string) $old === (string) $new) {
         $new .= "\n(Old and new values are identical.)";
     }
     $file_old = new TempFile();
     $file_new = new TempFile();
     Filesystem::writeFile($file_old, (string) $old . "\n");
     Filesystem::writeFile($file_new, (string) $new . "\n");
     list($err, $stdout) = exec_manual('diff %C -U %s %s %s', $diff_options, $context_lines, $file_old, $file_new);
     return $stdout;
 }
开发者ID:chaozhang80,项目名称:tool-package,代码行数:12,代码来源:ArcanistDiffUtils.php

示例12: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $path = xhpast_get_binary_path();
     if (!Filesystem::pathExists($path)) {
         throw new ConduitException('ERR-NOT-FOUND');
     }
     list($err, $stdout) = exec_manual('%s --version', $path);
     if ($err) {
         throw new ConduitException('ERR-COMMAND-FAILED');
     }
     return trim($stdout);
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:12,代码来源:ConduitAPI_phpast_version_Method.php

示例13: executeChecks

 protected function executeChecks()
 {
     $pygment = PhabricatorEnv::getEnvConfig('pygments.enabled');
     if ($pygment) {
         list($err) = exec_manual('pygmentize -h');
         if ($err) {
             $summary = pht('You enabled pygments but the pygmentize script is not ' . 'actually available, your $PATH is probably broken.');
             $message = pht('The environmental variable $PATH does not contain ' . 'pygmentize. You have enabled pygments, which requires ' . 'pygmentize to be available in your $PATH variable.');
             $this->newIssue('pygments.enabled')->setName(pht('pygmentize Not Found'))->setSummary($summary)->setMessage($message)->addRelatedPhabricatorConfig('pygments.enabled')->addPhabricatorConfig('environment.append-paths');
         }
     }
 }
开发者ID:denghp,项目名称:phabricator,代码行数:12,代码来源:PhabricatorSetupCheckPygment.php

示例14: getDefaultBinary

 public function getDefaultBinary()
 {
     $binary = 'go';
     if (Filesystem::binaryExists($binary)) {
         // Vet is only accessible through 'go vet' or 'go tool vet'
         // Let's manually try to find out if it's installed.
         list($err, $stdout, $stderr) = exec_manual('go tool vet');
         if ($err === 3) {
             throw new ArcanistMissingLinterException(sprintf("%s\n%s", pht('Unable to locate "go vet" to run linter %s. You may need ' . 'to install the binary, or adjust your linter configuration.', get_class($this)), pht('TO INSTALL: %s', $this->getInstallInstructions())));
         }
     }
     return $binary;
 }
开发者ID:voznesenskym,项目名称:arcanist,代码行数:13,代码来源:ArcanistGoVetLinter.php

示例15: getMercurialVersion

 public static function getMercurialVersion()
 {
     list($err, $stdout, $stderr) = exec_manual('hg --version --quiet');
     // NOTE: At least on OSX, recent versions of Mercurial report this
     // string in this format:
     //
     //   Mercurial Distributed SCM (version 3.1.1+20140916)
     $matches = null;
     $pattern = '/^Mercurial Distributed SCM \\(version ([\\d.]+)/m';
     if (preg_match($pattern, $stdout, $matches)) {
         return $matches[1];
     }
     return null;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:14,代码来源:PhabricatorRepositoryVersion.php


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