From: Colin P. Mccabe Date: Tue, 29 Nov 2016 23:16:14 +0000 (-0800) Subject: dssh: run ssh in the background when it's not being run interactively X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a033dadc060069ff475a47ef9745d855f94f90d7;p=cmccabe-bin dssh: run ssh in the background when it's not being run interactively --- diff --git a/dssh b/dssh index 7540c8b..14dd22c 100755 --- a/dssh +++ b/dssh @@ -50,10 +50,6 @@ if [ $# -eq 0 ]; then else RUN_COMMAND="${@}" fi -EXTRA_DOCKER_ARGS="" -if [ ${ALLOCATE_TTY} -ne 0 ]; then - EXTRA_DOCKER_ARGS="${EXTRA_DOCKER_ARGS} -t" -fi which docker &>/dev/null || die "docker must be on the PATH." @@ -74,4 +70,9 @@ else die "failed to find a docker image named ${DOCKER_IMAGE_NAME}" fi -docker exec -i ${EXTRA_DOCKER_ARGS} "${DOCKER_IMAGE_ID}" ${RUN_COMMAND} +if [ ${ALLOCATE_TTY} == 1 ]; then + docker exec -it "${DOCKER_IMAGE_ID}" ${RUN_COMMAND} +else + docker exec -i "${DOCKER_IMAGE_ID}" ${RUN_COMMAND} & + wait +fi