diff options
author | Eric Wong <e@80x24.org> | 2023-11-02 09:35:33 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-11-03 06:39:30 +0000 |
commit | cfe25e6aa966144a9c96d1ba2c301fd5e1bad79b (patch) | |
tree | 4faa9092c422aafca9568e547634096da12667e9 /lib/PublicInbox/LeiToMail.pm | |
parent | 16957ad7c4edcbf43294e67c8db06167594f0660 (diff) | |
download | public-inbox-cfe25e6aa966144a9c96d1ba2c301fd5e1bad79b.tar.gz |
This fixes two major problems with the use of tie for filehandles: * no way to do fcntl, stat, etc. calls directly on the tied handle, forcing callers to use the `tied' perlop to access the underlying IO::Handle * needing separate classes to handle blocking and non-blocking I/O As a result, Git->cleanup_if_unlinked, InputPipe->consume, and Qspawn->_yield_start have fewer bizzare bits and we can call `$io->blocking(0)' directly instead of `(tied *$io)->{fh}->blocking(0)' Having a PublicInbox::IO class will also allow us to support custom read buffering which allows inspecting the current state.
Diffstat (limited to 'lib/PublicInbox/LeiToMail.pm')
-rw-r--r-- | lib/PublicInbox/LeiToMail.pm | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm index ead60b38..b07c2c90 100644 --- a/lib/PublicInbox/LeiToMail.pm +++ b/lib/PublicInbox/LeiToMail.pm @@ -7,7 +7,7 @@ use strict; use v5.10.1; use parent qw(PublicInbox::IPC); use PublicInbox::Eml; -use PublicInbox::ProcessIO; +use PublicInbox::IO; use PublicInbox::Spawn qw(spawn); use IO::Handle; # ->autoflush use Fcntl qw(SEEK_SET SEEK_END O_CREAT O_EXCL O_WRONLY); @@ -160,8 +160,7 @@ sub _post_augment_mbox { # open a compressor process from top-level lei-daemon my $cmd = PublicInbox::MboxReader::zsfx2cmd($zsfx, undef, $lei); my ($r, $w) = @{delete $lei->{zpipe}}; my $rdr = { 0 => $r, 1 => $lei->{1}, 2 => $lei->{2}, pgid => 0 }; - my $pid = spawn($cmd, undef, $rdr); - $lei->{1} = PublicInbox::ProcessIO->maybe_new($pid, $w, + $lei->{1} = PublicInbox::IO::attach_pid($w, spawn($cmd, undef, $rdr), \&reap_compress, $lei, $cmd, $lei->{1}); } |