summaryrefslogtreecommitdiff
path: root/git-archimport.perl
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2005-11-24 07:47:39 (GMT)
committerMartin Langhoff <martin@catalyst.net.nz>2005-12-11 01:41:39 (GMT)
commit2777ef76be7174f698b3f53cc4ff38b4118de320 (patch)
treec40555d0064c7c51aa673fdb425156994d50ddb1 /git-archimport.perl
parent8b15e2fbc9d9b9d04c70fe590a3d0562d4334c38 (diff)
downloadgit-2777ef76be7174f698b3f53cc4ff38b4118de320.zip
git-2777ef76be7174f698b3f53cc4ff38b4118de320.tar.gz
git-2777ef76be7174f698b3f53cc4ff38b4118de320.tar.bz2
archimport: first, make sure it still compiles
(ML: And introduce safe_pipe_capture()) Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Diffstat (limited to 'git-archimport.perl')
-rwxr-xr-xgit-archimport.perl16
1 files changed, 16 insertions, 0 deletions
diff --git a/git-archimport.perl b/git-archimport.perl
index c3bed08..b5f8a2c 100755
--- a/git-archimport.perl
+++ b/git-archimport.perl
@@ -99,6 +99,7 @@ my %psets = (); # the collection, by name
my %rptags = (); # my reverse private tags
# to map a SHA1 to a commitid
+my $TLA = $ENV{'ARCH_CLIENT'} || 'tla';
foreach my $root (@arch_roots) {
my ($arepo, $abranch) = split(m!/!, $root);
@@ -850,3 +851,18 @@ sub commitid2pset {
|| (print Dumper(sort keys %psets)) && die "Cannot find patchset for $name";
return $ps;
}
+
+# an alterative to `command` that allows input to be passed as an array
+# to work around shell problems with weird characters in arguments
+sub safe_pipe_capture {
+ my @output;
+ if (my $pid = open my $child, '-|') {
+ @output = (<$child>);
+ close $child or die join(' ',@_).": $! $?";
+ } else {
+ exec(@_) or die $?; # exec() can fail the executable can't be found
+ }
+ return wantarray ? @output : join('',@output);
+}
+
+