Skip to content

Commit 3ad6812

Browse files
Clarify WP_CLI::runcommand()
1 parent 4789266 commit 3ad6812

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

_posts/2016-11-29-version-1.0.0.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ title: Version 1.0.0 released
66

77
Woohoo!
88

9-
*What does v1.0.0 mean?*
109

1110

1211
### Introducing `WP_CLI::runcommand()`
1312

14-
`WP_CLI::runcommand()` is the best way to run WP-CLI commands from within your WP-CLI command.
13+
`WP_CLI::runcommand()` ([doc](/docs/internal-api/wp-cli-runcommand/)) is the new best way to run WP-CLI commands from within your WP-CLI command. It's as though `WP_CLI::run_command()` and `WP_CLI::launch_self()` grew up, married, and had a perfect child.
14+
15+
With `WP_CLI::runcommand()`, you can:
16+
17+
* Launch a new child process (default), or reuse the existing process.
18+
* Optionally prevent the process from exiting on error.
19+
* Return STDOUT generated by the command, or all command execution details (STDOUT, STDERR, return_code) as an object.
20+
* Optionally parse captured STDOUT as JSON.
1521

1622
### Breaking changes: Uses return code 1 when batch operation partially fails.
1723

@@ -28,7 +34,9 @@ Affected commands include:
2834
* `wp term delete`
2935
* `wp widget (delete|deactivate|reset)`
3036

31-
Use `WP_CLI\Utils\report_batch_operation_results()` in your custom WP-CLI commands to more easily support this behavior.
37+
Use `WP_CLI\Utils\report_batch_operation_results()` ([doc](/docs/internal-api/wp-cli-utils-report-batch-operation-results/)) in your custom WP-CLI commands to more easily support this behavior.
38+
39+
See [this issue](https://github.com/wp-cli/wp-cli/issues/3577) for more background and rationale.
3240

3341
Relevant pull requests include: [#3584](https://github.com/wp-cli/wp-cli/pull/3584), [#3583](https://github.com/wp-cli/wp-cli/pull/3583), [#3582](https://github.com/wp-cli/wp-cli/pull/3582), [#3585](https://github.com/wp-cli/wp-cli/pull/3585), [#3586](https://github.com/wp-cli/wp-cli/pull/3586), [#3588](https://github.com/wp-cli/wp-cli/pull/3588)
3442

0 commit comments

Comments
 (0)