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


PHP posix_isatty函数代码示例

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


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

示例1: is_tty

 public static function is_tty()
 {
     if (self::$is_tty === null) {
         self::$is_tty = function_exists('posix_isatty') ? posix_isatty(STDOUT) : false;
     }
     return self::$is_tty;
 }
开发者ID:jaz303,项目名称:phake,代码行数:7,代码来源:Utils.php

示例2: __construct

 /**
  * Initializes default configuration.
  */
 public function __construct()
 {
     $templateDir = self::isInstalledByPear() ? '@data_dir@' . DIRECTORY_SEPARATOR . 'ApiGen' : realpath(__DIR__ . DIRECTORY_SEPARATOR . '..');
     self::$defaultConfig['templateConfig'] = $templateDir . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'default' . DIRECTORY_SEPARATOR . 'config.neon';
     self::$defaultConfig['colors'] = 'WIN' === substr(PHP_OS, 0, 3) ? false : (function_exists('posix_isatty') && defined('STDOUT') ? posix_isatty(STDOUT) : true);
     $this->config = self::$defaultConfig;
 }
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:10,代码来源:Config.php

示例3: isSupported

 /**
  * Returns true if the stream supports colorization.
  *
  * Colorization is disabled if not supported by the stream:
  *
  *  -  Windows without Ansicon, ConEmu or Babun
  *  -  non tty consoles
  *
  * @return bool true if the stream supports colorization, false otherwise
  *
  * @link https://github.com/symfony/Console/blob/master/Output/StreamOutput.php#L95-L102
  * @codeCoverageIgnore
  */
 public function isSupported()
 {
     if (DIRECTORY_SEPARATOR == '\\') {
         return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || false !== getenv('BABUN_HOME');
     }
     return false !== getenv('BABUN_HOME') || function_exists('posix_isatty') && @posix_isatty(STDOUT);
 }
开发者ID:kevinlebrun,项目名称:colors.php,代码行数:20,代码来源:Color.php

示例4: supports_colour

 static function supports_colour()
 {
     if (!defined('STDOUT')) {
         define('STDOUT', fopen("php://stdout", "w"));
     }
     return @posix_isatty(STDOUT);
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:7,代码来源:SSCli.php

示例5: __construct

 function __construct()
 {
     if (DIRECTORY_SEPARATOR == '\\' || !function_exists('posix_isatty') || !@posix_isatty(STDOUT)) {
         self::$colorizedOutputSupported = false;
     }
     $this->registerStyle('PARAMETER', array('fg' => 'cyan'))->registerStyle('COMMENT', array('fg' => 'green'))->registerStyle('INFO', array('fg' => 'blue'))->registerStyle('WARNING', array('fg' => 'magenta'))->registerStyle('ERROR', array('fg' => 'red', 'bold' => true))->registerStyle('ACTION_DELETE', array('fg' => 'red'))->registerStyle('BOLD', array('bold' => true))->registerStyle('ITALIC', array('italic' => true));
 }
开发者ID:pago,项目名称:pantr,代码行数:7,代码来源:Output.php

示例6: setupColors

 /**
  * Configures colored output.
  * @return void
  */
 public static function setupColors()
 {
     self::$useColors = getenv(self::COLORS) !== FALSE ? (bool) getenv(self::COLORS) : (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') && (function_exists('posix_isatty') && posix_isatty(STDOUT) || getenv('ConEmuANSI') === 'ON' || getenv('ANSICON') !== FALSE) || getenv('TERM') === 'xterm-256color';
     ob_start(function ($s) {
         return self::$useColors ? $s : Dumper::removeColors($s);
     }, 1, FALSE);
 }
开发者ID:nette,项目名称:tester,代码行数:11,代码来源:Environment.php

示例7: hasColorSupport

 /**
  * Returns true if the stream supports colorization.
  *
  * Colorization is disabled if not supported by the stream:
  *
  *  -  Windows without Ansicon, ConEmu or Mintty
  *  -  non tty consoles
  *
  * @return bool true if the stream supports colorization, false otherwise
  */
 protected function hasColorSupport()
 {
     if (DIRECTORY_SEPARATOR === '\\') {
         return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM');
     }
     return function_exists('posix_isatty') && @posix_isatty($this->stream);
 }
开发者ID:edwardricardo,项目名称:zenska,代码行数:17,代码来源:StreamOutput.php

示例8: hasColorSupport

/**
* Code from Symfony/Component/Console/Output/StreamOutput.php
*/
function hasColorSupport()
{
    if (DIRECTORY_SEPARATOR == '\\') {
        return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI');
    }
    return function_exists('posix_isatty') && @posix_isatty(STDOUT);
}
开发者ID:Ingewikkeld,项目名称:phing,代码行数:10,代码来源:phing.php

示例9: isInteractive

 public function isInteractive()
 {
     if (null === $this->isInteractive) {
         $this->isInteractive = 'cli' === php_sapi_name() && (function_exists('posix_isatty') && @posix_isatty(STDOUT) || 'ON' === getenv('ConEmuANSI') || false !== getenv('ANSICON'));
     }
     return $this->isInteractive;
 }
开发者ID:griffbrad,项目名称:gasp,代码行数:7,代码来源:Terminal.php

示例10: setupColors

 /**
  * Configures colored output.
  * @return void
  */
 public static function setupColors()
 {
     self::$useColors = getenv(self::COLORS) !== FALSE ? (bool) getenv(self::COLORS) : PHP_SAPI === 'cli' && (function_exists('posix_isatty') && posix_isatty(STDOUT) || getenv('ConEmuANSI') === 'ON' || getenv('ANSICON') !== FALSE);
     ob_start(function ($s) {
         return Environment::$useColors ? $s : Dumper::removeColors($s);
     }, PHP_VERSION_ID < 50400 ? 2 : 1);
 }
开发者ID:cujan,项目名称:vcelyweb,代码行数:11,代码来源:Environment.php

示例11: supportsAnsi

 /**
  * {@inheritdoc}
  */
 public function supportsAnsi()
 {
     if (DIRECTORY_SEPARATOR === '\\') {
         return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM');
     }
     return function_exists('posix_isatty') && @posix_isatty($this->stream);
 }
开发者ID:webmozart,项目名称:console,代码行数:10,代码来源:StreamOutputStream.php

示例12: call_phing

 public static function call_phing($task, $target, $build_file = '', $options = array())
 {
     $args = array();
     foreach ($options as $key => $value) {
         $args[] = "-D{$key}={$value}";
     }
     if ($build_file) {
         $args[] = '-f';
         $args[] = realpath($build_file);
     }
     if (!$task->is_verbose()) {
         $args[] = '-q';
     }
     if (is_array($target)) {
         $args = array_merge($args, $target);
     } else {
         $args[] = $target;
     }
     if (DIRECTORY_SEPARATOR != '\\' && (function_exists('posix_isatty') && @posix_isatty(STDOUT))) {
         $args[] = '-logger';
         $args[] = 'phing.listener.AnsiColorLogger';
     }
     Phing::startup();
     Phing::setProperty('phing.home', getenv('PHING_HOME'));
     $m = new pakePhing();
     $m->execute($args);
     $m->runBuild();
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:28,代码来源:pakePhingTask.class.php

示例13: __construct

 /**
  * Initialize
  * @param array
  * @param array
  * @param array
  * @param Executor
  * @param bool
  */
 public function __construct(array $argv, array $envp, array $descriptors, Executor $executor, $interactive = NULL)
 {
     $this->argv = $argv;
     $this->envp = $envp;
     if (!isset($this->envp['PS1'])) {
         $this->envp['PS1'] = self::DEFAULT_PS1;
     }
     if (!isset($this->envp['PS2'])) {
         $this->envp['PS2'] = self::DEFAULT_PS2;
     }
     $this->descriptors = $descriptors;
     list($this->stdin, $this->stdout, $this->stderr) = $this->descriptors;
     $this->executor = $executor;
     if (!is_bool($interactive)) {
         $interactive = FALSE;
         if (function_exists('posix_isatty') && @posix_isatty($descriptors[0])) {
             $interactive = TRUE;
         }
     }
     $this->interactive = $interactive;
     if ($this->interactive) {
         $descriptors[0] = fopen('sh-interactiveinput://', NULL, FALSE, stream_context_create(array('sh-interactiveinput' => array('handle' => $this->stdin, 'out' => $this->stdout))));
         $this->descriptors[1] = fopen('sh-interactiveoutput://', NULL, FALSE, stream_context_create(array('sh-interactiveoutput' => array('handle' => $this->descriptors[1]))));
         $this->descriptors[2] = fopen('sh-interactiveoutput://', NULL, FALSE, stream_context_create(array('sh-interactiveoutput' => array('handle' => $this->descriptors[2]))));
     }
 }
开发者ID:jakubkulhan,项目名称:pssh,代码行数:34,代码来源:sh.php

示例14: run

 public function run()
 {
     $method = $this->getArgument('method', array());
     if (count($method) !== 1) {
         throw new ArcanistUsageException(pht('Provide exactly one Conduit method name.'));
     }
     $method = reset($method);
     $console = PhutilConsole::getConsole();
     if (!function_exists('posix_isatty') || posix_isatty(STDIN)) {
         $console->writeErr("%s\n", pht('Waiting for JSON parameters on stdin...'));
     }
     $params = @file_get_contents('php://stdin');
     try {
         $params = phutil_json_decode($params);
     } catch (PhutilJSONParserException $ex) {
         throw new ArcanistUsageException(pht('Provide method parameters on stdin as a JSON blob.'));
     }
     $error = null;
     $error_message = null;
     try {
         $result = $this->getConduit()->callMethodSynchronous($method, $params);
     } catch (ConduitClientException $ex) {
         $error = $ex->getErrorCode();
         $error_message = $ex->getMessage();
         $result = null;
     }
     echo json_encode(array('error' => $error, 'errorMessage' => $error_message, 'response' => $result)) . "\n";
     return 0;
 }
开发者ID:barcelonascience,项目名称:arcanist,代码行数:29,代码来源:ArcanistCallConduitWorkflow.php

示例15: run

 public function run($folder)
 {
     set_time_limit(0);
     $this->useColors = PHP_SAPI === 'cli' && (function_exists('posix_isatty') && posix_isatty(STDOUT) || getenv('ConEmuANSI') === 'ON' || getenv('ANSICON') !== FALSE);
     if ($this->readOnly) {
         echo "Running in read-only mode\n";
     }
     echo "Scanning folder {$this->color('white', $folder)}\n";
     $counter = 0;
     $success = TRUE;
     foreach (Nette\Utils\Finder::findFiles($this->accept)->exclude($this->ignore)->from($folder)->exclude($this->ignore) as $file) {
         echo str_pad(str_repeat('.', $counter++ % 40), 40), "\r";
         $orig = $s = file_get_contents($file);
         $this->file = ltrim(substr($file, strlen($folder)), '/\\');
         $this->error = FALSE;
         foreach ($this->tasks as $task) {
             $res = $task($this, $s);
             if ($this->error) {
                 $success = FALSE;
                 continue 2;
             } elseif (is_string($res)) {
                 $s = $res;
             }
         }
         if ($s !== $orig && !$this->readOnly) {
             file_put_contents($file, $s);
         }
     }
     echo str_pad('', 40), "\rDone.\n";
     return $success;
 }
开发者ID:sallyx,项目名称:code-checker,代码行数:31,代码来源:code-checker.php


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