Help_Command::pass_through_pager
Метод класса: Help_Command{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$result = Help_Command::pass_through_pager( $out );
- $out(обязательный)
- .
Код Help_Command::pass_through_pager() Help Command::pass through pager WP-CLI 2.13.0-alpha
private static function pass_through_pager( $out ) {
if ( ! Utils\check_proc_available( null /*context*/, true /*return*/ ) ) {
WP_CLI::line( $out );
WP_CLI::debug( 'Warning: check_proc_available() failed in pass_through_pager().', 'help' );
return -1;
}
$pager = getenv( 'PAGER' );
if ( false === $pager ) {
$pager = Utils\is_windows() ? 'more' : 'less -R';
}
// For Windows 7 need to set code page to something other than Unicode (65001) to get around "Not enough memory." error with `more.com` on PHP 7.1+.
if ( 'more' === $pager && defined( 'PHP_WINDOWS_VERSION_MAJOR' ) && PHP_WINDOWS_VERSION_MAJOR < 10 ) {
// Note will also apply to Windows 8 (see https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832.aspx) but probably harmless anyway.
$cp = getenv( 'WP_CLI_WINDOWS_CODE_PAGE' ) ?: 1252; // Code page 1252 is the most used so probably the most compat.
sapi_windows_cp_set( $cp );
}
// Convert string to file handle.
$fd = fopen( 'php://temp', 'r+b' );
fwrite( $fd, $out );
rewind( $fd );
$descriptorspec = [
0 => $fd,
1 => STDOUT,
2 => STDERR,
];
return proc_close( Utils\proc_open_compat( $pager, $descriptorspec, $pipes ) );
}