about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-05-10T00·38+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-05-10T00·38+0200
commit3a0cc43ac89ae8f778764c9f5e27b361e4986913 (patch)
treecb3a4a95ad67c62deb6007cb4c0ef846c16411b5 /scripts
parentbe0b9dda31ab42bb2e077751fc75abbc945e407f (diff)
build-remote.pl: Properly close the SSH connection between attempts
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build-remote.pl.in7
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/build-remote.pl.in b/scripts/build-remote.pl.in
index dcd863003602..00d7cd8b4186 100755
--- a/scripts/build-remote.pl.in
+++ b/scripts/build-remote.pl.in
@@ -195,9 +195,10 @@ REQ: while (1) {
         # Connect to the selected machine.
         @sshOpts = ("-i", $machine->{sshKeys}, "-x");
         $hostName = $machine->{hostName};
-        last REQ if
-            openSSHConnection($hostName) &&
-            system("ssh $hostName @sshOpts nix-builds-inhibited < /dev/null > /dev/null 2>&1") != 0;
+        if (openSSHConnection($hostName)) {
+            last REQ if system("ssh $hostName @sshOpts nix-builds-inhibited < /dev/null > /dev/null 2>&1") != 0;
+            closeSSHConnection;
+        }
 
         warn "unable to open SSH connection to $hostName, trying other available machines...\n";
         $machine->{enabled} = 0;