about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiConvert.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-03-26 09:51:25 +0000
committerEric Wong <e@80x24.org>2021-03-26 23:08:18 +0000
commit65ec1f78464ce8cf4f6379aca7bbae38743c50f0 (patch)
tree0eb594c491282fdec01b7aafc39a45485a39c287 /lib/PublicInbox/LeiConvert.pm
parentd69102cfff67e4308c560c5e8daa8f8a486ff24d (diff)
downloadpublic-inbox-65ec1f78464ce8cf4f6379aca7bbae38743c50f0.tar.gz
Since lei-daemon won't have the same FDs as the client, we
need to special-case thse mappings and won't be able to open
arbitrary, non-standard FDs.

We also won't attempt to support /proc/self/fd/[0-2] since
that's a Linux-ism.  /dev/fd/[0-2] and /dev/std{in,out,err}
are portable to FreeBSD, at least.  mawk(1) also supports
/dev/std{out,err}, as does gawk(1) (which supports everything
we can support, and arbitrary /dev/fd/$FD).
Diffstat (limited to 'lib/PublicInbox/LeiConvert.pm')
-rw-r--r--lib/PublicInbox/LeiConvert.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/LeiConvert.pm b/lib/PublicInbox/LeiConvert.pm
index 0cc65108..083ecc33 100644
--- a/lib/PublicInbox/LeiConvert.pm
+++ b/lib/PublicInbox/LeiConvert.pm
@@ -50,7 +50,8 @@ sub lei_convert { # the main "lei convert" method
         my $ovv = PublicInbox::LeiOverview->new($lei, 'out-format');
         $lei->{l2m} or return
                 $lei->fail("output not specified or is not a mail destination");
-        $lei->{opt}->{augment} = 1 unless $ovv->{dst} eq '/dev/stdout';
+        my $devfd = $lei->path_to_fd($ovv->{dst}) // return;
+        $lei->{opt}->{augment} = 1 if $devfd < 0;
         $self->prepare_inputs($lei, \@inputs) or return;
         my $op = $lei->workers_start($self, 'lei_convert', 1);
         $lei->{cnv} = $self;