WP_CLI

Process::run_check_stderrpublicWP-CLI 1.0

Run the command, but throw an Exception on error. Same as run_check() above, but checks the correct stderr.

Метод класса: Process{}

Хуков нет.

Возвращает

ProcessRun.

Использование

$Process = new Process();
$Process->run_check_stderr();

Код Process::run_check_stderr() WP-CLI 2.13.0-alpha

public function run_check_stderr() {
	$r = $this->run();

	if ( $r->return_code ) {
		throw new RuntimeException( $r );
	}

	if ( ! empty( $r->stderr ) ) {
		// If the only thing that STDERR caught was the Requests deprecated message, ignore it.
		// This is a temporary fix until we have a better solution for dealing with Requests
		// as a dependency shared between WP Core and WP-CLI.
		$stderr_lines = array_filter( explode( "\n", $r->stderr ) );
		if ( 1 === count( $stderr_lines ) ) {
			$stderr_line = $stderr_lines[0];
			if (
				false !== strpos(
					$stderr_line,
					'The PSR-0 `Requests_...` class names in the Request library are deprecated.'
				)
			) {
				return $r;
			}
		}

		throw new RuntimeException( $r );
	}

	return $r;
}