]> Sergey Matveev's repositories - public-inbox.git/commit
lei q: fix --import-before default and FIFO output
authorEric Wong <e@80x24.org>
Fri, 5 Mar 2021 01:38:29 +0000 (18:38 -0700)
committerEric Wong <e@80x24.org>
Fri, 5 Mar 2021 07:20:21 +0000 (07:20 +0000)
commit7d186c6fa885c7b04c9e2a65b3fc501120b7866f
treefad4e8c5a14b038246ae68fa058e6b068714eb62
parent2958cd17d58c79c952afae6cfd594595ffcaf4fa
lei q: fix --import-before default and FIFO output

commit 6c551bffd75afb41d9b5e4774068abe7e06ed0e7
("lei q: --import-augment for mbox and mbox.gz") added a check to
in _pre_augment_mbox for the option being a ref() to distinguish
between default values and user-supplied values (which are
non-ref SCALARs from Getopt::Long).

However, LeiQuery failed to use a SCALAR ref as the default
value, making the check in _pre_augment_mbox useless.  We
now update LeiQuery to use \1 instead of 1 as the default
value so "lei q -f mboxrd ..." to stdout works once again.

Unfortunately, testing with redirects pointed to regular
files didn't trigger the code paths being updated.  Testing
with a FIFO revealed further bugs in the FIFO handling code
which are also fixed in this commit.

We'll also update the $lei->out error message to be
less-specific about "stdout" and use the term "output", instead,
since LeiToMail replaces stdout for all mbox outputs.
lib/PublicInbox/LEI.pm
lib/PublicInbox/LeiQuery.pm
lib/PublicInbox/LeiToMail.pm
t/lei-q-kw.t