WP_CLI\Utils
proc_open_compat()
Windows compatible proc_open(). Works around bug in PHP, and also deals with *nix-like ENV_VAR=blah cmd environment variable prefixes.
No Hooks.
Returns
resource. Command stripped of any environment variable settings.
Usage
proc_open_compat( $cmd, $descriptorspec, $pipes, $cwd, $env, $other_options );
- $cmd(string) (required)
- Command to execute.
- $descriptorspec(required)
- .
- $pipes(required) (passed by reference — &)
- .
- $cwd(string)
- Initial working directory for the command.
Default: null - $env
- .
Default: null - $other_options(array
) - Array of additional options (Windows only).
Default: null
proc_open_compat() proc open compat code WP-CLI 2.13.0-alpha
function proc_open_compat( $cmd, $descriptorspec, &$pipes, $cwd = null, $env = null, $other_options = null ) {
if ( is_windows() ) {
$cmd = _proc_open_compat_win_env( $cmd, $env );
}
return proc_open( $cmd, $descriptorspec, $pipes, $cwd, $env, $other_options );
}