aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-02-04 02:38:40 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-02-04 02:38:40 +0000
commit443673620d908cb35c569c929701ba6b4c9dfc69 (patch)
tree7870e11ecae0760fbfdf9667cbf354c0b547b492
parent7ec5a659252148ad87191108622e9ab7e9712605 (diff)
* Don't use ssh's -f flag since it leads to lots of lingering ssh
processes.
-rw-r--r--scripts/ssh.pm14
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/ssh.pm b/scripts/ssh.pm
index 233c5a4aa..c6d667a65 100644
--- a/scripts/ssh.pm
+++ b/scripts/ssh.pm
@@ -18,8 +18,18 @@ sub openSSHConnection {
or die "cannot create a temporary directory";
push @sshOpts, "-S", "$tmpDir/control";
- system("ssh $sshHost @sshOpts -M -N -f") == 0
- or return 0;
+
+ # Start the master. We can't use the `-f' flag (fork into
+ # background after establishing the connection) because then the
+ # child continues to run if we are killed. So instead make SSH
+ # print "started" when it has established the connection, and wait
+ # until we see that.
+ open SSH, "ssh $sshHost @sshOpts -M -N -o LocalCommand='echo started' -o PermitLocalCommand=yes |" or die;
+ while (<SSH>) {
+ chomp;
+ last if /started/;
+ }
+
$sshStarted = 1;
return 1;
}