WP_CLI\Utils

force_env_on_nix_systems()WP-CLI 1.0

Maybe prefix command string with "/usr/bin/env". Removes (if there) if Windows, adds (if not there) if not.

Хуков нет.

Возвращает

Строку.

Использование

force_env_on_nix_systems( $command );
$command(строка) (обязательный)
-

Код force_env_on_nix_systems() WP-CLI 2.8.0-alpha

function force_env_on_nix_systems( $command ) {
	$env_prefix     = '/usr/bin/env ';
	$env_prefix_len = strlen( $env_prefix );
	if ( is_windows() ) {
		if ( 0 === strncmp( $command, $env_prefix, $env_prefix_len ) ) {
			$command = substr( $command, $env_prefix_len );
		}
	} elseif ( 0 !== strncmp( $command, $env_prefix, $env_prefix_len ) ) {
		$command = $env_prefix . $command;
	}
	return $command;
}