Removes the extension dependency on non-windows for parserTests.
Currently used on install-utils.inc readconsole(), eval.php and parserTests.inc
Maintenance scripts receive it via commandLine.inc -> Maintenance.php .. doMaintenance.php -> install-utils.inc
}
if ( function_exists( 'readline_add_history' )
- && function_exists( 'posix_isatty' ) && posix_isatty( 0 /*STDIN*/ ) )
+ && posix_isatty( 0 /*STDIN*/ ) )
{
$useReadline = true;
} else {
}
}
+if ( !function_exists( 'posix_isatty' ) ) {
+ # We default as considering stdin a tty (for nice readline methods)
+ # but treating stout as not a tty to avoid color codes
+ function posix_isatty( $fd ) {
+ return !$fd;
+ }
+}
+
function readconsole( $prompt = '' ) {
static $isatty = null;
if ( is_null( $isatty ) ) {
- if ( !function_exists( 'posix_isatty' ) || posix_isatty( 0 /*STDIN*/ ) ) {
+ if ( posix_isatty( 0 /*STDIN*/ ) ) {
$isatty = true;
} else {
$isatty = false;