DarcsInput: Avoid a chdir.

This commit is contained in:
Petr Rockai 2013-09-07 14:47:49 +02:00
parent 66f3e60e2a
commit 0041c336d1

View file

@ -27,14 +27,13 @@ sub fetchInput {
my $clonePath = $cacheDir . "/" . sha256_hex($uri); my $clonePath = $cacheDir . "/" . sha256_hex($uri);
$uri =~ s|^file://||; # darcs wants paths, not file:// uris $uri =~ s|^file://||; # darcs wants paths, not file:// uris
chdir $ENV{"TMPDIR"}; # sigh. darcs needs a writeable working directory
my $stdout = ""; my $stderr = ""; my $res; my $stdout = ""; my $stderr = ""; my $res;
if (! -d $clonePath) { if (! -d $clonePath) {
# Clone the repository. # Clone the repository.
($res, $stdout, $stderr) = captureStdoutStderr(600, $res = run(timeout => 600,
("darcs", "get", "--lazy", $uri, $clonePath)); cmd => ["darcs", "get", "--lazy", $uri, $clonePath],
die "Error getting darcs repo at `$uri':\n$stderr" if $res; dir => $ENV{"TMPDIR"});
die "Error getting darcs repo at `$uri':\n$stderr" if $res->{status};
} }
# Update the repository to match $uri. # Update the repository to match $uri.