private static function pass_through_pager($out) { $pager = Utils\is_windows() ? 'more' : 'less -r'; // convert string to file handle $fd = fopen("php://temp", "r+"); fputs($fd, $out); rewind($fd); $descriptorspec = array(0 => $fd, 1 => STDOUT, 2 => STDERR); return proc_close(proc_open($pager, $descriptorspec, $pipes)); }
private static function pass_through_pager($out) { if (Utils\is_windows()) { // no paging for Windows cmd.exe; sorry echo $out; return 0; } // convert string to file handle $fd = fopen("php://temp", "r+"); fputs($fd, $out); rewind($fd); $descriptorspec = array(0 => $fd, 1 => STDOUT, 2 => STDERR); return proc_close(proc_open('less -r', $descriptorspec, $pipes)); }
private function init_colorization() { if ('auto' === $this->config['color']) { $this->colorize = !\cli\Shell::isPiped() && !\WP_CLI\Utils\is_windows(); } else { $this->colorize = $this->config['color']; } }