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.


resource. Command stripped of any environment variable settings.


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 — &)
Initial working directory for the command.
Default: null
Array of environment variables.
Default: null
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 );