<commit_before><?php

class WP_CLI_Command_Runner {

	private $install_dir;

	public function __construct() {
		$this->install_dir = sys_get_temp_dir() . '/' . uniqid( "wp-cli-test-", TRUE );
		mkdir( $this->install_dir );
	}

	public function run( $command, $cwd = false ) {
		if ( !$cwd )
			$cwd = $this->install_dir;

		$wp_cli_path = getcwd() . "/bin/wp";

		$sh_command = "cd $cwd; $wp_cli_path $command";

		$process = proc_open( $sh_command, array(
			0 => STDIN,
			1 => array( 'pipe', 'w' ),
			2 => array( 'pipe', 'w' ),
		), $pipes );

		$stdout = stream_get_contents( $pipes[1] );
		fclose( $pipes[1] );

		$stderr = stream_get_contents( $pipes[2] );
		fclose( $pipes[2] );

		$return_code = proc_close( $process );

		return (object) compact( 'return_code', 'stdout', 'stderr' );
	}

	public function create_config( $db_settings ) {
		return $this->run( 'core config' . \WP_CLI\Utils\assoc_args_to_str( $db_settings ) );
	}
<commit_msg>make cmd runner return command string, for easy debugging<commit_after><?php

class WP_CLI_Command_Runner {

	private $install_dir;

	public function __construct() {
		$this->install_dir = sys_get_temp_dir() . '/' . uniqid( "wp-cli-test-", TRUE );
		mkdir( $this->install_dir );
	}

	public function run( $command, $cwd = false ) {
		if ( !$cwd )
			$cwd = $this->install_dir;

		$wp_cli_path = getcwd() . "/bin/wp";

		$sh_command = "cd $cwd; $wp_cli_path $command";

		$process = proc_open( $sh_command, array(
			0 => STDIN,
			1 => array( 'pipe', 'w' ),
			2 => array( 'pipe', 'w' ),
		), $pipes );

		$stdout = stream_get_contents( $pipes[1] );
		fclose( $pipes[1] );

		$stderr = stream_get_contents( $pipes[2] );
		fclose( $pipes[2] );

		$return_code = proc_close( $process );

		return (object) compact( 'command', 'return_code', 'stdout', 'stderr' );
	}

	public function create_config( $db_settings ) {
		return $this->run( 'core config' . \WP_CLI\Utils\assoc_args_to_str( $db_settings ) );
	}

{'fraction_non_alphanumeric': 0.18209718670076727, 'fraction_numerical': 0.007161125319693095, 'mean_word_length': 3.89, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3362068', 'n_tokens_mistral': 828, 'n_tokens_neox': 760, 'n_words': 163}