Merge pull request #2513 from punkstar/detect-tty

Only allocate a tty if we detect one
This commit is contained in:
Aanand Prasad 2015-12-08 15:26:46 +00:00
commit 53cc99a822
1 changed files with 7 additions and 1 deletions

View File

@ -43,5 +43,11 @@ if [ -n "$HOME" ]; then
VOLUMES="$VOLUMES -v $HOME:$HOME"
fi
# Only allocate tty if we detect one
if [ -t 1 ]; then
DOCKER_RUN_OPTIONS="-ti"
else
DOCKER_RUN_OPTIONS="-i"
fi
exec docker run --rm -ti $DOCKER_ADDR $COMPOSE_OPTIONS $VOLUMES -w $(pwd) $IMAGE $@
exec docker run --rm $DOCKER_RUN_OPTIONS $DOCKER_ADDR $COMPOSE_OPTIONS $VOLUMES -w $(pwd) $IMAGE $@