Skip to content

WP_CLI::runcommand() and WP_CLI::launch_self() should use Runner::$alias in command string #5620

@humanik

Description

@humanik

Describe how other contributors can replicate this bug

Register commands

add_action(
	'cli_init',
	function () {
		WP_CLI::add_command(
			'first',
			function () {
				WP_CLI::runcommand( 'second' );
			}
		);

		WP_CLI::add_command(
			'second',
			function () {
				WP_CLI::log( 'second' );
			}
		);
	}
);

setup alias in ~/.wp-cli/config.yml

@wp:
  path: [PATH_TO_PROJECT]

and run wp @wp first not from current project directory.

Describe what you expect as the correct outcome

Expect second output but has warning No WordPress installation found

Provide a possible solution

wp-cli/php/class-wp-cli.php

Lines 1333 to 1335 in f94e77d

$runtime_config = Utils\assoc_args_to_str( $runtime_config );
$runcommand = "{$php_bin} {$script_path} {$runtime_config} {$command}";

Should add current alias to $runcommand string.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions