]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Git.pm
www: label sections and hopefully improve navigation
[public-inbox.git] / lib / PublicInbox / Git.pm
index 473cdffa88d4c5d96230c308815fa0b74ea894dc..f47bc439080749c25100aca9cb1bb0f32b2d7c13 100644 (file)
@@ -28,7 +28,9 @@ sub _bidi_pipe {
 
        my @cmd = ('git', "--git-dir=$self->{git_dir}", qw(cat-file), $batch);
        my $redir = { 0 => fileno($out_r), 1 => fileno($in_w) };
-       $self->{$pid} = spawn(\@cmd, undef, $redir);
+       my $p = spawn(\@cmd, undef, $redir);
+       defined $p or fail($self, "spawn failed: $!");
+       $self->{$pid} = $p;
        $out_w->autoflush(1);
        $self->{$out} = $out_w;
        $self->{$in} = $in_r;
@@ -122,6 +124,8 @@ sub popen {
 sub qx {
        my ($self, @cmd) = @_;
        my $fh = $self->popen(@cmd);
+       defined $fh or return;
+       local $/ = "\n";
        return <$fh> if wantarray;
        local $/;
        <$fh>