WP_CLI\Utils
force_env_on_nix_systems()
Maybe prefix command string with "/usr/bin/env". Removes (if there) if Windows, adds (if not there) if not.
No Hooks.
Return
String
.
Usage
force_env_on_nix_systems( $command );
- $command(string) (required)
- -
force_env_on_nix_systems() force env on nix systems code 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; }