Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 4, 2025

Conversation

drzraf
Copy link
Contributor

@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

codecov-commenter commented Mar 1, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

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

Please upload report for BASE (main@90c9a75). Learn more about missing BASE report.

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

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6057   +/-   ##
=======================================
  Coverage        ?   22.85%           
  Complexity      ?     1747           
=======================================
  Files           ?       87           
  Lines           ?     6239           
  Branches        ?        0           
=======================================
  Hits            ?     1426           
  Misses          ?     4813           
  Partials        ?        0           
Flag Coverage Δ
unit 22.85% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@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