diff options
-rw-r--r-- | lib/PublicInbox/Qspawn.pm | 19 | ||||
-rw-r--r-- | lib/PublicInbox/RepobrowseGitSnapshot.pm | 2 |
2 files changed, 8 insertions, 13 deletions
diff --git a/lib/PublicInbox/Qspawn.pm b/lib/PublicInbox/Qspawn.pm index da770cc0..73022656 100644 --- a/lib/PublicInbox/Qspawn.pm +++ b/lib/PublicInbox/Qspawn.pm @@ -74,10 +74,10 @@ sub _psgi_finish ($$) { sub psgi_qx { my ($self, $env, $limiter, $qx_cb) = @_; - my $qx = PublicInbox::Qspawn::Qx->new($qx_cb); + my $qx = PublicInbox::Qspawn::Qx->new; my $end = sub { _psgi_finish($self, $env); - $qx->close; + eval { $qx_cb->($qx) }; $qx = undef; }; my $rpipe; @@ -196,19 +196,14 @@ use strict; use warnings; sub new { - my ($class, $cb) = @_; - bless [ '', $cb ], $class; + my ($class) = @_; + my $buf = ''; + bless \$buf, $class; } +# called by PublicInbox::HTTPD::Async ($fh->write) sub write { - $_[0]->[0] .= $_[1]; - undef; -} - -sub close { - my ($self) = @_; - my $cb = $self->[1]; - eval { $cb->(\($self->[0])) }; + ${$_[0]} .= $_[1]; undef; } diff --git a/lib/PublicInbox/RepobrowseGitSnapshot.pm b/lib/PublicInbox/RepobrowseGitSnapshot.pm index cceb4641..a9751b97 100644 --- a/lib/PublicInbox/RepobrowseGitSnapshot.pm +++ b/lib/PublicInbox/RepobrowseGitSnapshot.pm @@ -87,7 +87,7 @@ sub call_git_snapshot ($$) { # invoked by PublicInbox::RepobrowseBase::call $env->{'qspawn.quiet'} = 1; my $tree_cb = $env->{'repobrowse.tree_cb'} = sub { my ($ref) = @_; - if (ref($ref) eq 'SCALAR') { + if (defined $ref) { $tree = $$ref; chomp $tree; } |