summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2017-02-17 14:21:33 +0000
committerChristophe Lyon <christophe.lyon@linaro.org>2017-02-17 14:37:31 +0000
commit9228f533990c1de12af85d3bcf6e8b7cd604107b (patch)
tree09079c58ef70f5325080c275421ffee3bfdae0d6
parent45e9014b91dad3dcb8bd230a8b0411dd195260d6 (diff)
start-container-docker.sh: Fix ssh-agent invocation.
To avoid leaking file descriptors 3 and 4, which would otherwise make an external pipe hang (eg tee). Change-Id: I62921634bdcb8b98b88198c007ba5e628a1475db
-rwxr-xr-xstart-container-docker.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/start-container-docker.sh b/start-container-docker.sh
index a99b7cb4..23d8e3c5 100755
--- a/start-container-docker.sh
+++ b/start-container-docker.sh
@@ -155,7 +155,10 @@ if [ "x`whoami`" = "xtcwg-buildslave" ]; then
# only if it is not already running. Indeed, even if we want to
# start several containers, we need only one ssh-agent.
if [ -f $HOME/.ssh/id_rsa -a "x${SSH_AGENT_PID}" = "x" ]; then
- eval `ssh-agent -s`
+ # Close fds 3 and 4 in ssh-agent's subshell, otherwise they
+ # leak into the background daemon, and prevent this script
+ # from working in a pipeline
+ eval `ssh-agent -s 3>&- 4>&-`
ssh-add $HOME/.ssh/id_rsa
CONTAINER_CLEANUP="eval \`ssh-agent -k\`"
fi