about summary refs log tree commit diff
path: root/perl
diff options
context:
space:
mode:
Diffstat (limited to 'perl')
-rw-r--r--perl/lib/Nix/CopyClosure.pm16
1 files changed, 8 insertions, 8 deletions
diff --git a/perl/lib/Nix/CopyClosure.pm b/perl/lib/Nix/CopyClosure.pm
index 5085ec075b96..53da72038d64 100644
--- a/perl/lib/Nix/CopyClosure.pm
+++ b/perl/lib/Nix/CopyClosure.pm
@@ -78,6 +78,13 @@ sub copyTo {
     my @missing = grep { !$present{$_} } @closure;
     return if !@missing;
 
+    my $missingSize = 0;
+    $missingSize += (queryPathInfo($_, 1))[3] foreach @missing;
+
+    printf STDERR "copying %d missing paths (%.2f MiB) to ‘$sshHost’...\n",
+        scalar(@missing), $missingSize / (1024.0^2);
+    return if $dryRun;
+
     # Send the "import paths" command.
     syswrite($to, pack("L<x4", 4)) or die;
     writeString($compressor, $to);
@@ -85,11 +92,7 @@ sub copyTo {
     if ($compressor || $progressViewer) {
 
         # Compute the size of the closure for the progress viewer.
-        if ($progressViewer) {
-            my $missingSize = 0;
-            $missingSize += (queryPathInfo($_, 1))[3] foreach @missing;
-            $progressViewer = "$progressViewer -s $missingSize";
-        }
+        $progressViewer = "$progressViewer -s $missingSize" if $progressViewer;
 
         # Start the compressor and/or progress viewer in between us
         # and the remote host.
@@ -107,9 +110,6 @@ sub copyTo {
     }
 
     readInt($from) == 1 or die "remote machine \`$sshHost' failed to import closure\n";
-
-    # Shut down the server process.
-    waitpid $pid, 0;
 }