Index: trunk/phase3/install-utils.inc |
— | — | @@ -57,10 +57,18 @@ |
58 | 58 | } |
59 | 59 | |
60 | 60 | 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' ) ) { |
62 | 68 | return readline( $prompt ); |
63 | 69 | } else { |
64 | | - print $prompt; |
| 70 | + if ( $isatty ) { |
| 71 | + print $prompt; |
| 72 | + } |
65 | 73 | $fp = fopen( 'php://stdin', 'r' ); |
66 | 74 | $st = fgets($fp, 1024); |
67 | 75 | if ($st === false) return false; |