Browse Source

Detect -t and -i separately

Signed-off-by: Chia-liang Kao <[email protected]>
Chia-liang Kao 9 years ago
parent
commit
674e541cf7
1 changed files with 4 additions and 3 deletions
  1. 4 3
      script/run.sh

+ 4 - 3
script/run.sh

@@ -47,9 +47,10 @@ fi
 
 
 # Only allocate tty if we detect one
 # Only allocate tty if we detect one
 if [ -t 1 ]; then
 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
 fi
 
 
 exec docker run --rm $DOCKER_RUN_OPTIONS $DOCKER_ADDR $COMPOSE_OPTIONS $VOLUMES -w "$(pwd)" $IMAGE $@
 exec docker run --rm $DOCKER_RUN_OPTIONS $DOCKER_ADDR $COMPOSE_OPTIONS $VOLUMES -w "$(pwd)" $IMAGE $@