1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-06 08:46:26 +02:00

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>
This commit is contained in:
Eric Wong 2005-11-23 23:47:39 -08:00 committed by Martin Langhoff
parent 8b15e2fbc9
commit 2777ef76be

View File

@ -99,6 +99,7 @@ END
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);
}