diff options
author | Eric Wong <e@80x24.org> | 2023-09-22 21:13:15 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-09-22 22:39:39 +0000 |
commit | 9607495558f891c4f3cb3efdc2e605af71c5b2a1 (patch) | |
tree | e77903ede4d1f0ba0df23cc4f63fa7944847ba24 /lib/PublicInbox/LeiToMail.pm | |
parent | 135f34ac52b4c6118753027c03cd8e88286aa037 (diff) | |
download | public-inbox-9607495558f891c4f3cb3efdc2e605af71c5b2a1.tar.gz |
Our awaitpid API now exists and ProcessPipe uses it, so it's immune to cyclic references. Thus there's no need to create a duplicate of the lei object to prevent leaks.
Diffstat (limited to 'lib/PublicInbox/LeiToMail.pm')
-rw-r--r-- | lib/PublicInbox/LeiToMail.pm | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm index 7c7967c8..4adcc33e 100644 --- a/lib/PublicInbox/LeiToMail.pm +++ b/lib/PublicInbox/LeiToMail.pm @@ -151,10 +151,9 @@ sub git_to_mail { # git->cat_async callback } sub reap_compress { # awaitpid callback - my ($pid, $lei) = @_; - my $cmd = delete $lei->{"pid.$pid"}; - return if $? == 0; - $lei->fail($?, "@$cmd failed"); + my ($pid, $lei, $cmd, $old_out) = @_; + $lei->{1} = $old_out; + $lei->fail($?, "@$cmd failed") if $?; } sub _post_augment_mbox { # open a compressor process from top-level process @@ -165,9 +164,8 @@ sub _post_augment_mbox { # open a compressor process from top-level process my $rdr = { 0 => $r, 1 => $lei->{1}, 2 => $lei->{2}, pgid => 0 }; my $pid = spawn($cmd, undef, $rdr); my $pp = gensym; - my $dup = bless { "pid.$pid" => $cmd }, ref($lei); - $dup->{$_} = $lei->{$_} for qw(2 sock); - tie *$pp, 'PublicInbox::ProcessPipe', $pid, $w, \&reap_compress, $dup; + tie *$pp, 'PublicInbox::ProcessPipe', $pid, $w, + \&reap_compress, $lei, $cmd, $lei->{1}; $lei->{1} = $pp; } |