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

PHP posix_isatty函数代码示例

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

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



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


示例16: setColor

 /**
  * Set color
  *
  * @param   bool color
  * @return  self
  */
 public function setColor($color)
 {
     if (null === $color) {
         $color = $this->out instanceof ConsoleOutputStream && function_exists('posix_isatty') ? posix_isatty(STDOUT) : true;
     }
     $this->colored = $color;
 }
开发者ID:xp-framework,项目名称:unittest,代码行数:13,代码来源:DefaultListener.class.php


示例17: isSupportedShell

 /**
  * Identify if console supports colors
  *
  * @return boolean
  */
 public static function isSupportedShell()
 {
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM');
     }
     return defined('STDOUT') && function_exists('posix_isatty') && posix_isatty(STDOUT);
 }
开发者ID:zhao5908,项目名称:phalcon-devtools,代码行数:12,代码来源:Color.php


示例18: hasColorSupport

 /**
  * Returns true if the stream supports colorization.
  *
  * Colorization is disabled if not supported by the stream:
  *
  *  -  Windows != 10.0.10586 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 '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR . '.' . PHP_WINDOWS_VERSION_MINOR . '.' . PHP_WINDOWS_VERSION_BUILD || false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM');
     }
     return function_exists('posix_isatty') && @posix_isatty($this->stream);
 }
开发者ID:kelvinmbwilo,项目名称:VVS,代码行数:17,代码来源:StreamOutput.php


示例19: isSupported

 /**
  * @return bool
  */
 public function isSupported()
 {
     if (DIRECTORY_SEPARATOR === '\\') {
         return getenv('ANSICON') !== false || getenv('ConEmuANSI') === 'ON';
     }
     return function_exists('posix_isatty') && @posix_isatty(STDOUT);
 }
开发者ID:cruni505,项目名称:prestomed,代码行数:10,代码来源:ConsoleColor.php


示例20: main

 public function main()
 {
     $this->_initDb();
     $cli = new \Console_CommandLine_Result();
     $cli->options = $this->params;
     $cli->args = array('files' => $this->args);
     // Check if we can use colors
     if ($cli->options['color'] === 'auto') {
         $cli->options['color'] = DIRECTORY_SEPARATOR != '\\' && function_exists('posix_isatty') && @posix_isatty(STDOUT);
     } else {
         $cli->options['color'] = filter_var($cli->options['color'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
     }
     if (empty($cli->args['files'])) {
         $cli->args['files'] = array(ROOT . DS . 'spec');
     }
     if (!($cli->options['verbose'] || $cli->options['debug'])) {
         set_error_handler(array($this, 'skipWarning'), E_WARNING | E_NOTICE);
     }
     if ($cli->options['dump']) {
         $module = new DrSlump\Spec\Cli\Modules\Dump($cli);
         $module->run();
     } else {
         $module = new DrSlump\Spec\Cli\Modules\Test($cli);
         $module->run();
     }
 }
开发者ID:nojimage,项目名称:Bdd,代码行数:26,代码来源:SpecShell.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP posix_kill函数代码示例发布时间:2022-05-15
下一篇:
PHP posix_getuid函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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