From 9afe2737ab0c34996daf973cb37cfb13b6bdddaf Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 28 Jan 2020 13:02:06 -0800 Subject: [PATCH] envsetup.sh: Do not allocate pseudo TTY in non-interactive mode This fixes the deformed output with control characters and progress bar expansions, output now looks like it is on interactive shells To use docker run in a shell pipeline or under shell redirection make run accept stdin and output to stdout and stderr appropriately Signed-off-by: Khem Raj --- envsetup.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/envsetup.sh b/envsetup.sh index 570fc8e1d..19d98e1f0 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -467,10 +467,12 @@ dkr() { check_docker || return 1 CMD="$1" + PSEUDOTTY="" if [ -z "$CMD" ]; then echo "setting dkr action to shell" CMD="/bin/bash" + PSEUDOTTY="--tty" fi SSH_AUTH_DIR=~/ @@ -492,7 +494,7 @@ dkr() { SSH_AUTH_DIR=$(readlink -f $SSH_AUTH_SOCK) fi - docker run --rm -it \ + docker run --rm -i ${PSEUDOTTY} --log-driver=none -a stdin -a stdout -a stderr \ -v $(pwd):$(pwd) \ -v ~/.ssh:/home/build/.ssh \ -v ~/.gitconfig:/home/build/.gitconfig \