You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to have a WP_CLI::run_command() which:
Accepted the command as a string (e.g. 'rest post list --format=json'), because this is the most intuitive way for a developer to define the argument. These passed arguments would be automatically shell escaped, so the caller didn't have to worry about it.
Supported launching a new process, or running the command within the existing process. If a new process was launched, then the method would appropriately recycle our environment variables.
This seems like the way to go, as both launch_self and run_command didn't work for me and I was more/less forced to reimplement this based on what you did in the rest diff command there.
Currently, we have two different ways of running new WP-CLI commands from within an existing command:
WP_CLI::launch_self()
- launches a new process while reusing some runtime args and env variables, but not all.WP_CLI::run_command()
- calls the WP-CLI command using the existing process.It's confusing to use these methods within a WP-CLI command, so I still end up writing my own implementation (e.g. wp-cli/restful@778c3e0#diff-157c802629de9f14607866f958873927R209)
It would be nice to have a
WP_CLI::run_command()
which:'rest post list --format=json'
), because this is the most intuitive way for a developer to define the argument. These passed arguments would be automatically shell escaped, so the caller didn't have to worry about it.proc_open()
instead ofpassthru()
to persist TTY mode #3117), or captured and returned the result of the execution.The text was updated successfully, but these errors were encountered: