about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiLcat.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/LeiLcat.pm')
-rw-r--r--lib/PublicInbox/LeiLcat.pm21
1 files changed, 9 insertions, 12 deletions
diff --git a/lib/PublicInbox/LeiLcat.pm b/lib/PublicInbox/LeiLcat.pm
index d553b187..191f6f24 100644
--- a/lib/PublicInbox/LeiLcat.pm
+++ b/lib/PublicInbox/LeiLcat.pm
@@ -124,18 +124,15 @@ could not extract Message-ID from $x
 
 sub _stdin { # PublicInbox::InputPipe::consume callback for --stdin
         my ($lei) = @_; # $_[1] = $rbuf
-        if (defined($_[1])) {
-                $_[1] eq '' and return eval {
-                        $lei->fchdir or return;
-                        my @argv = split(/\s+/, $lei->{mset_opt}->{qstr});
-                        $lei->{mset_opt}->{qstr} = extract_all($lei, @argv)
-                                or return;
-                        $lei->_start_query;
-                };
-                $lei->{mset_opt}->{qstr} .= $_[1];
-        } else {
-                $lei->fail("error reading stdin: $!");
-        }
+        $_[1] // return $lei->fail("error reading stdin: $!");
+        return $lei->{mset_opt}->{qstr} .= $_[1] if $_[1] ne '';
+        eval {
+                $lei->fchdir;
+                my @argv = split(/\s+/, $lei->{mset_opt}->{qstr});
+                $lei->{mset_opt}->{qstr} = extract_all($lei, @argv) or return;
+                $lei->_start_query;
+        };
+        $lei->fail($@) if $@;
 }
 
 sub lei_lcat {