`wp plugin activate` should show what unexpected output the plugin generated
If a plugin generates output during activation, activate_plugin will return an WP_Error object configured like this:
$output = ob_get_clean();
return new WP_Error( 'unexpected_output', __( 'The plugin generated unexpected output.' ), $output );
As you can see, the output is passed as the third parameter, and the error has code "unexpected_output".
I have a use-case where I need the output that was generated for logging reasons.
Relevant code that should print the output:
https://github.com/wp-cli/extension-command/blob/409b3f6defa9d02f32b5f04bbf969a9906e1f6de/src/Plugin_Command.php#L347-L354
Hey @Luc45,
Thanks for the suggestion!
I have a use-case where I need the output that was generated for logging reasons.
I'm a little hesitant about changing the output solely for this use case.
What do you think about instead running the $result through an action, so your custom code can capture and report the output however you need?