Detect -t and -i separately

Signed-off-by: Chia-liang Kao <clkao@clkao.org>
This commit is contained in:
Chia-liang Kao 2016-02-14 01:43:06 +08:00
parent dd55415d4f
commit e6a675f338
1 changed files with 4 additions and 3 deletions

View File

@ -47,9 +47,10 @@ fi
# Only allocate tty if we detect one
if [ -t 1 ]; then
DOCKER_RUN_OPTIONS="-ti"
else
DOCKER_RUN_OPTIONS="-i"
DOCKER_RUN_OPTIONS="-t"
fi
if [ -t 0 ]; then
DOCKER_RUN_OPTIONS="$DOCKER_RUN_OPTIONS -i"
fi
exec docker run --rm $DOCKER_RUN_OPTIONS $DOCKER_ADDR $COMPOSE_OPTIONS $VOLUMES -w "$(pwd)" $IMAGE $@