Skip to content

Commit

Permalink
Merge pull request #145 from skeltoac/update-tty-checks
Browse files Browse the repository at this point in the history
Update TTY checks
  • Loading branch information
schlessera authored Jul 1, 2021
2 parents e472e08 + 36989c5 commit a286685
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/cli/Shell.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ static public function isPiped() {
if ($shellPipe !== false) {
return filter_var($shellPipe, FILTER_VALIDATE_BOOLEAN);
} else {
return (function_exists('posix_isatty') && !posix_isatty(STDOUT));
if ( function_exists('stream_isatty') ) {
return !stream_isatty(STDOUT);
} else {
return (function_exists('posix_isatty') && !posix_isatty(STDOUT));
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion lib/cli/Streams.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ static function _call( $func, $args ) {
}

static public function isTty() {
return (function_exists('posix_isatty') && posix_isatty(static::$out));
if ( function_exists('stream_isatty') ) {
return !stream_isatty(static::$out);
} else {
return (function_exists('posix_isatty') && !posix_isatty(static::$out));
}
}

/**
Expand Down

0 comments on commit a286685

Please sign in to comment.