about summary refs log tree commit diff
path: root/scripts/nix-copy-closure.in
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/nix-copy-closure.in')
-rwxr-xr-xscripts/nix-copy-closure.in5
1 files changed, 2 insertions, 3 deletions
diff --git a/scripts/nix-copy-closure.in b/scripts/nix-copy-closure.in
index abd3760fc138..05faa63917da 100755
--- a/scripts/nix-copy-closure.in
+++ b/scripts/nix-copy-closure.in
@@ -81,9 +81,6 @@ while (@ARGV) {
 die "$0: you did not specify a host name\n" unless defined $sshHost;
 
 
-openSSHConnection $sshHost or die "$0: unable to start SSH\n";
-
-
 if ($toMode) { # Copy TO the remote machine.
     Nix::CopyClosure::copyTo(
         $sshHost, [ @sshOpts ], [ @storePaths ], $compressor, $decompressor,
@@ -92,6 +89,8 @@ if ($toMode) { # Copy TO the remote machine.
 
 else { # Copy FROM the remote machine.
 
+    openSSHConnection $sshHost or die "$0: unable to start SSH\n";
+
     # Query the closure of the given store paths on the remote
     # machine.  Paths are assumed to be store paths; there is no
     # resolution (following of symlinks).