fix the compose call: it never worked outside --dry-run
Setting IFS to a newline to pass the environment also stopped the command line from splitting, so '-f a -f b' went out as a single argument and the two words 'docker compose' were looked up as one program name. Every real command was broken; only --dry-run, which prints a string, looked right. The variables are now exported in a subshell instead of going through env(1), which keeps values with spaces intact and leaves the command line to normal word splitting. The tests only checked what --dry-run printed, which is why they missed it. spec/unit/compose_spec.sh now asserts the argv that is actually executed, for both the plugin and the standalone binary.
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
#!/bin/sh
|
||||
[ -n "${MYOS_DOCKER_LOG:-}" ] && printf 'docker-compose %s\n' "$*" >> "$MYOS_DOCKER_LOG"
|
||||
if [ -n "${MYOS_DOCKER_LOG:-}" ]; then
|
||||
printf 'docker-compose %s\n' "$*" >> "$MYOS_DOCKER_LOG"
|
||||
# the environment is recorded too, so a test can assert what was exported
|
||||
env > "$(dirname "$MYOS_DOCKER_LOG")/env.log"
|
||||
fi
|
||||
case "$1" in version) echo "${MOCK_COMPOSE_VERSION:-2.29.0}" ;; config) echo "# mock compose config" ;; *) : ;; esac
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user