Skip to content

Commit 97aa530

Browse files
committed
Handled stdin in docker-compose
1 parent 057fa28 commit 97aa530

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

scripts/itkdev-docker-compose

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,18 @@ fi
282282

283283
# Helper function to call `docker-compose` in the right context
284284
docker_compose () {
285+
local command="$1"
286+
shift
287+
local command_options=""
288+
289+
# We must pass "-T" to docker-compose exec when piping input
290+
if [ "$command" = "exec" ] && [ ! -t 0 ]; then
291+
command_options="-T"
292+
fi
293+
285294
# Note: Apparently, using --project-directory or --file options for `docker-compose` will break use of `$PWD` in
286295
# docker-compose.yml. Therefore, we `cd` before running `docker-compose` command.
287-
(cd "$docker_compose_dir" && COMPOSE_DOMAIN=${COMPOSE_DOMAIN} docker-compose "$@")
296+
(cd "$docker_compose_dir" && COMPOSE_DOMAIN=${COMPOSE_DOMAIN} docker-compose "$command" $command_options "$@")
288297
}
289298

290299
cmd="$1"

0 commit comments

Comments
 (0)