Run a WP-CLI command in a new process reusing the current runtime arguments.
WP_CLI::launch_self( $command, $args = array(), $assoc_args = array(), $exit_on_error = true, $return_detailed = false, $runtime_args = array() )
$args (array) Positional arguments to include when calling the command.
$assoc_args (array) Associative arguments to include when calling the command.
$exit_on_error (bool) Whether to exit if the command returns an elevated return code.
$return_detailed (bool) Whether to return an exit status (default) or detailed execution results.
$runtime_args (array) Override one or more global args (path,url,user,allow-root)
@return (int|ProcessRun) command exit status, or a ProcessRun instance
WP_CLI::runcommand() instead, which is easier to use and works better.
Note: While this command does persist a limited set of runtime arguments, it does not persist environment variables. Practically speaking, WP-CLI packages won’t be loaded when using WP_CLI::launch_self() because the launched process doesn’t have access to the current process $HOME.
Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.