Skip to content

Commit a286685

Browse files
authored
Merge pull request #145 from skeltoac/update-tty-checks
Update TTY checks
2 parents e472e08 + 36989c5 commit a286685

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/cli/Shell.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ static public function isPiped() {
9191
if ($shellPipe !== false) {
9292
return filter_var($shellPipe, FILTER_VALIDATE_BOOLEAN);
9393
} else {
94-
return (function_exists('posix_isatty') && !posix_isatty(STDOUT));
94+
if ( function_exists('stream_isatty') ) {
95+
return !stream_isatty(STDOUT);
96+
} else {
97+
return (function_exists('posix_isatty') && !posix_isatty(STDOUT));
98+
}
9599
}
96100
}
97101

lib/cli/Streams.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ static function _call( $func, $args ) {
1414
}
1515

1616
static public function isTty() {
17-
return (function_exists('posix_isatty') && posix_isatty(static::$out));
17+
if ( function_exists('stream_isatty') ) {
18+
return !stream_isatty(static::$out);
19+
} else {
20+
return (function_exists('posix_isatty') && !posix_isatty(static::$out));
21+
}
1822
}
1923

2024
/**

0 commit comments

Comments
 (0)