Browse Source

Merge pull request #2513 from punkstar/detect-tty

Only allocate a tty if we detect one
Aanand Prasad 10 years ago
parent
commit
53cc99a822
1 changed files with 7 additions and 1 deletions
  1. 7 1
      script/run.sh

+ 7 - 1
script/run.sh

@@ -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 $@