Linux systems with at least some versions of PHP
For some reason posix_isatty(STDIN) prints a warning on Linux about being unable to seek, though it gives the right return value and has no obvious ill effects otherwise.
No such warning appears on Mac OS X.
Using the raw file descriptor number (0 for stdin) seems to work, and is already used in the parser test framework where it checks stdout (1) this way.
parser tests when Chinese tables were getting loaded into Serbian code.
* (bug 8380) Be nicer about blank lines in deleteBatch.php
* (bug 8401) Fix regression in SORBS lookup for some DNS setups
+* Use raw file descriptor in posix_isatty() check to avoid warning on
+ Linux systems with at least some versions of PHP
== Languages updated ==
function readconsole( $prompt = '' ) {
static $isatty = null;
if ( is_null( $isatty ) ) {
- if ( !function_exists( 'posix_isatty' ) || posix_isatty( STDIN ) ) {
+ if ( !function_exists( 'posix_isatty' ) || posix_isatty( 0 /*STDIN*/ ) ) {
$isatty = true;
} else {
$isatty = false;