Skip to content

Commit

Permalink
build-remote.pl: Properly close the SSH connection between attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed May 10, 2013
1 parent be0b9dd commit 3a0cc43
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions perl/lib/Nix/SSH.pm
Expand Up @@ -44,6 +44,7 @@ sub closeSSHConnection {
if ($sshStarted) {
system("ssh $sshHost @sshOpts -O exit 2> /dev/null") == 0
or warn "unable to stop SSH master: $?";
$sshStarted = 0;
}
}

Expand Down
7 changes: 4 additions & 3 deletions scripts/build-remote.pl.in
Expand Up @@ -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;
Expand Down

0 comments on commit 3a0cc43

Please sign in to comment.