about summary refs log tree commit homepage
path: root/lib/PublicInbox/Qspawn.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/Qspawn.pm')
-rw-r--r--lib/PublicInbox/Qspawn.pm19
1 files changed, 7 insertions, 12 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;
 }