WP_CLI\Utils

check_proc_available()WP-CLI 1.0

No Hooks.

Return

true|false.

Usage

check_proc_available( $context, $return );
$context(string)
If set will appear in error message.
Default: null
$return(true|false)
If set will return false rather than error out.
Default: false

check_proc_available() code WP-CLI 2.7.0-alpha

function check_proc_available( $context = null, $return = false ) {
	if ( ! function_exists( 'proc_open' ) || ! function_exists( 'proc_close' ) ) {
		if ( $return ) {
			return false;
		}
		$msg = 'The PHP functions `proc_open()` and/or `proc_close()` are disabled. Please check your PHP ini directive `disable_functions` or suhosin settings.';
		if ( $context ) {
			WP_CLI::error( sprintf( "Cannot do '%s': %s", $context, $msg ) );
		} else {
			WP_CLI::error( $msg );
		}
	}
	return true;
}