Use WP_CLI::runcommand() instead, which is easier to use and works better.
To run a command using a new process with the same global parameters,
use WP_CLI::launch_self(). To run a command using a new process with
different global parameters, use WP_CLI::launch().
ob_start();
WP_CLI::run_command( array( 'cli', 'cmd-dump' ) );
$ret = ob_get_clean();
public static run_command ( array $args, array $assoc_args = [] ) | ||
$args | array | Positional arguments including command name. |
$assoc_args | array |