about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiToMail.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-09-27 06:02:48 +0000
committerEric Wong <e@80x24.org>2023-09-28 02:34:57 +0000
commit10ca39f5bddcb414dac2a3fcee4cc53844c74fc1 (patch)
treefeb7b4dc50ffd3e5c1bb6da13a10cf97bc2e7ba9 /lib/PublicInbox/LeiToMail.pm
parent3cea12e29643a02bc9d33802896d3dd12c8bc8fa (diff)
downloadpublic-inbox-10ca39f5bddcb414dac2a3fcee4cc53844c74fc1.tar.gz
This makes interesting parts of our code easier to read IMHO.
We can take advantage of `local' while avoiding `fileno' calls
since it's called in spawn() anyways to reduce LoC even further.
Diffstat (limited to 'lib/PublicInbox/LeiToMail.pm')
-rw-r--r--lib/PublicInbox/LeiToMail.pm7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm
index 4adcc33e..a2cd8650 100644
--- a/lib/PublicInbox/LeiToMail.pm
+++ b/lib/PublicInbox/LeiToMail.pm
@@ -9,7 +9,6 @@ use parent qw(PublicInbox::IPC);
 use PublicInbox::Eml;
 use PublicInbox::ProcessPipe;
 use PublicInbox::Spawn qw(spawn);
-use Symbol qw(gensym);
 use IO::Handle; # ->autoflush
 use Fcntl qw(SEEK_SET SEEK_END O_CREAT O_EXCL O_WRONLY);
 use PublicInbox::Syscall qw(rename_noreplace);
@@ -163,10 +162,8 @@ sub _post_augment_mbox { # open a compressor process from top-level process
         my ($r, $w) = @{delete $lei->{zpipe}};
         my $rdr = { 0 => $r, 1 => $lei->{1}, 2 => $lei->{2}, pgid => 0 };
         my $pid = spawn($cmd, undef, $rdr);
-        my $pp = gensym;
-        tie *$pp, 'PublicInbox::ProcessPipe', $pid, $w,
-                        \&reap_compress, $lei, $cmd, $lei->{1};
-        $lei->{1} = $pp;
+        $lei->{1} = PublicInbox::ProcessPipe->maybe_new($pid, $w, {
+                        cb_arg => [\&reap_compress, $lei, $cmd, $lei->{1} ] });
 }
 
 # --augment existing output destination, with deduplication