File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 285285
286286# Helper function to call `docker-compose` in the right context
287287docker_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
293307cmd=" $1 "
You can’t perform that action at this time.
0 commit comments