Skip to content

docker scheme: working-directory and stdin passing (reroll of #5974)#6057

Merged
swissspidy merged 2 commits intowp-cli:mainfrom
drzraf:4972-docker-stdin
Mar 4, 2025
Merged

docker scheme: working-directory and stdin passing (reroll of #5974)#6057
swissspidy merged 2 commits intowp-cli:mainfrom
drzraf:4972-docker-stdin

Conversation

@drzraf
Copy link
Copy Markdown

@drzraf drzraf commented Mar 1, 2025

#5974 reroll

  1. docker exec and docker-compose exec provide an option to cleanly set the working directory before running a command
    => Use it instead and use cd <...> ; command-prefixing in vagrant/ssh cases

  2. Using docker scheme, wp post update 1 - <<<foo didn't worked (issue passing stdin to command for docker-based WP instances #4972)

  • Because STDOUT being a tty, -t is passed with no ability to inhibit this
  • Because docker -i flag is necessary

=> As such:

  • docker -i (--interactive) is introduced (with sensible autodetection)
  • WP_CLI_DOCKER_NO_TTY and WP_CLI_DOCKER_NO_INTERACTIVE environment variables are introduced to optionally inhibit these respective flags

Special case to handle behat runs (see #5974)

   cleanly set the working directory before running a command
=> Use it instead and use `cd <...> ;` command-prefixing in vagrant/ssh cases

2. Using `docker` scheme, `wp post update 1 - <<<foo` didn't worked (issue wp-cli#4972)
* Because STDOUT being a tty, `-t` is passed with no ability to inhibit this
* Because docker `-i` flag is necessary

=> As such:
* docker `-i` (`--interactive`) is introduced (with sensible autodetection)
* `WP_CLI_DOCKER_NO_TTY` and `WP_CLI_DOCKER_NO_INTERACTIVE` environment variables
  are introduced to optionally inhibit these respective flags
@drzraf drzraf requested a review from a team as a code owner March 1, 2025 19:44
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 1, 2025

Codecov Report

❌ Patch coverage is 0% with 16 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
php/WP_CLI/Runner.php 0.00% 16 Missing ⚠️

📢 Thoughts on this report? Let us know!

@mrsdizzie mrsdizzie added this to the 2.12.0 milestone Mar 4, 2025
@swissspidy swissspidy merged commit 88cbe48 into wp-cli:main Mar 4, 2025
44 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants