-
Notifications
You must be signed in to change notification settings - Fork 998
docker scheme: working-directory and stdin passing #5974
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
Conversation
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
ping? |
I already tested this in the past, and while it seemed to do what it is supposed to do, I was unsure at the time whether I considered all implications and tested all edge cases. Thanks for the PR, @drzraf ! |
@schlessera This actually had some test failures, see https://github.com/wp-cli/wp-cli/actions/runs/13191576733/job/36825712748#step:11:295 for example |
@drzraf @schlessera Unfortunately I had to temporarily revert this in #6049 because of a test failure. But we can try to land it again. |
Can't reproduce the failure locally:
and the full run gives
but none of these 5 failures matches those mentioned by the CI |
The problem is that in the CI it is setting the -i flag (from the new code in this PR), which you can see in the failed test:
But the test does not expect that new Lines 357 to 362 in 63115a0
The tests pass locally because You can reproduce the CI failure by piping the test through cat which will remove the tty:
FWIW I think the double negative here is a bit confusing and hard to follow
The test should probably be updated and include the environment variables so the output is the same across local and ci testing. I think otherwise it would require creating a new custom step to check for tty if we really wanted to test the tty detection as well. |
docker scheme: working-directory and stdin passing (reroll of #5974)
docker exec
anddocker-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 casesUsing
docker
scheme,wp post update 1 - <<<foo
didn't worked (issue passing stdin to command for docker-based WP instances #4972)-t
is passed with no ability to inhibit this-i
flag is necessary=> As such:
-i
(--interactive
) is introduced (with sensible autodetection)WP_CLI_DOCKER_NO_TTY
andWP_CLI_DOCKER_NO_INTERACTIVE
environment variables are introduced to optionally inhibit these respective flags