Skip to content

Commit a05563d

Browse files
authored
Merge pull request #12 from itk-dev/feature/handle-stdin
Add additional environment variables to docker-compose call
2 parents 70b82af + 9d036e7 commit a05563d

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

scripts/itkdev-docker-compose

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,23 @@ fi
285285

286286
# Helper function to call `docker-compose` in the right context
287287
docker_compose () {
288+
local command="$1"
289+
shift
290+
local command_options=()
291+
292+
# We must pass "-T" to docker-compose exec when piping input
293+
if [ "$command" = "exec" ] && [ ! -t 0 ]; then
294+
command_options+=(-T)
295+
fi
296+
297+
# Set screen size
298+
if [[ "$command" =~ exec|run ]]; then
299+
command_options+=(-e COLUMNS=$(tput cols) -e LINES=$(tput lines))
300+
fi
301+
288302
# Note: Apparently, using --project-directory or --file options for `docker-compose` will break use of `$PWD` in
289303
# docker-compose.yml. Therefore, we `cd` before running `docker-compose` command.
290-
(cd "$docker_compose_dir" && COMPOSE_DOMAIN=${COMPOSE_DOMAIN} docker-compose "$@")
304+
(cd "$docker_compose_dir" && COMPOSE_DOMAIN=${COMPOSE_DOMAIN} docker-compose "$command" ${command_options[@]:+${command_options[@]}} "$@")
291305
}
292306

293307
cmd="$1"

0 commit comments

Comments
 (0)