From 0041c336d1311bff0478e7cdb41316ccd1dc82eb Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Sat, 7 Sep 2013 14:47:49 +0200 Subject: [PATCH] DarcsInput: Avoid a chdir. --- src/lib/Hydra/Plugin/DarcsInput.pm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib/Hydra/Plugin/DarcsInput.pm b/src/lib/Hydra/Plugin/DarcsInput.pm index 4c593842..c6227123 100644 --- a/src/lib/Hydra/Plugin/DarcsInput.pm +++ b/src/lib/Hydra/Plugin/DarcsInput.pm @@ -27,14 +27,13 @@ sub fetchInput { my $clonePath = $cacheDir . "/" . sha256_hex($uri); $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; if (! -d $clonePath) { # Clone the repository. - ($res, $stdout, $stderr) = captureStdoutStderr(600, - ("darcs", "get", "--lazy", $uri, $clonePath)); - die "Error getting darcs repo at `$uri':\n$stderr" if $res; + $res = run(timeout => 600, + cmd => ["darcs", "get", "--lazy", $uri, $clonePath], + dir => $ENV{"TMPDIR"}); + die "Error getting darcs repo at `$uri':\n$stderr" if $res->{status}; } # Update the repository to match $uri.