WP_CLI\Utils

proc_open_compat()WP-CLI 1.0

Windows compatible proc_open(). Works around bug in PHP, and also deals with *nix-like ENV_VAR=blah cmd environment variable prefixes.

No Hooks.

Return

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(array) (required)
Indexed array of descriptor numbers and their values.
$pipes (required) (passed by reference — &)
-
$cwd(string)
Initial working directory for the command.
Default: null
$env(array)
Array of environment variables.
Default: null
$other_options(array)
Array of additional options (Windows only).
Default: null

proc_open_compat() code WP-CLI 2.8.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 );
}