r10945 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r10944‎ | r10945 | r10946 >
Date:08:49, 8 September 2005
Author:timstarling
Status:old
Tags:
Comment:
Added isatty() check to readconsole()
Modified paths:
  • /trunk/phase3/install-utils.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/install-utils.inc
@@ -57,10 +57,18 @@
5858 }
5959
6060 function readconsole( $prompt = '' ) {
61 - if ( function_exists( 'readline' ) ) {
 61+ if ( function_exists( 'posix_isatty' ) && posix_isatty( STDIN ) ) {
 62+ $isatty = true;
 63+ } else {
 64+ $isatty = false;
 65+ }
 66+
 67+ if ( $isatty && function_exists( 'readline' ) ) {
6268 return readline( $prompt );
6369 } else {
64 - print $prompt;
 70+ if ( $isatty ) {
 71+ print $prompt;
 72+ }
6573 $fp = fopen( 'php://stdin', 'r' );
6674 $st = fgets($fp, 1024);
6775 if ($st === false) return false;

Status & tagging log