* Remove other uses of IPC::Open2.

This commit is contained in:
Eelco Dolstra 2005-09-21 17:14:52 +00:00
parent 95304172a5
commit 607a2f01e6

View file

@ -1,7 +1,6 @@
#! @perl@ -w -I@libexecdir@/nix #! @perl@ -w -I@libexecdir@/nix
use strict; use strict;
use IPC::Open2;
use POSIX qw(tmpnam); use POSIX qw(tmpnam);
use readmanifest; use readmanifest;
@ -62,20 +61,17 @@ foreach my $path (@ARGV) {
# Get all paths referenced by the normalisation of the given # Get all paths referenced by the normalisation of the given
# Nix expression. # Nix expression.
my $pid = open2(\*READ, \*WRITE, my $pid = open(READ,
"$binDir/nix-store --query --requisites --force-realise " . "$binDir/nix-store --query --requisites --force-realise " .
"--include-outputs '$path'") or die; "--include-outputs '$path'|") or die;
close WRITE;
while (<READ>) { while (<READ>) {
chomp; chomp;
die "bad: $_" unless /^\//; die "bad: $_" unless /^\//;
$storePaths{$_} = ""; $storePaths{$_} = "";
} }
close READ;
waitpid $pid, 0; close READ or die "nix-store failed: $?";
$? == 0 or die "nix-store failed";
} }
my @storePaths = keys %storePaths; my @storePaths = keys %storePaths;
@ -104,18 +100,14 @@ close NIX;
# Instantiate store expressions from the Nix expression. # Instantiate store expressions from the Nix expression.
my @storeExprs; my @storeExprs;
print STDERR "instantiating store expressions...\n"; print STDERR "instantiating store expressions...\n";
my $pid = open2(\*READ, \*WRITE, "$binDir/nix-instantiate $nixfile") my $pid = open(READ, "$binDir/nix-instantiate $nixfile|")
or die "cannot run nix-instantiate"; or die "cannot run nix-instantiate";
close WRITE;
while (<READ>) { while (<READ>) {
chomp; chomp;
die unless /^\//; die unless /^\//;
push @storeExprs, $_; push @storeExprs, $_;
} }
close READ; close READ or die "nix-instantiate failed: $?";
waitpid $pid, 0;
$? == 0 or die "nix-instantiate failed";
# Realise the store expressions. # Realise the store expressions.
@ -130,18 +122,14 @@ while (scalar @tmp > 0) {
my @tmp2 = @tmp[0..$n - 1]; my @tmp2 = @tmp[0..$n - 1];
@tmp = @tmp[$n..scalar @tmp - 1]; @tmp = @tmp[$n..scalar @tmp - 1];
my $pid = open2(\*READ, \*WRITE, "$binDir/nix-store --realise @tmp2") my $pid = open(READ, "$binDir/nix-store --realise @tmp2|")
or die "cannot run nix-store"; or die "cannot run nix-store";
close WRITE;
while (<READ>) { while (<READ>) {
chomp; chomp;
die unless (/^\//); die unless (/^\//);
push @narPaths, "$_"; push @narPaths, "$_";
} }
close READ; close READ or die "nix-store failed: $?";
waitpid $pid, 0;
$? == 0 or die "nix-store failed";
} }