This is needed for t/lei-import.t on FreeBSD, it should be necessary on
Linux, but I didn't notice problems there...

diff --git a/lib/PublicInbox/LeiInput.pm b/lib/PublicInbox/LeiInput.pm
index eed0eed7..d916249a 100644
--- a/lib/PublicInbox/LeiInput.pm
+++ b/lib/PublicInbox/LeiInput.pm
@@ -113,21 +113,29 @@ sub prepare_inputs { # returns undef on error
 --in-format=$in_fmt and `$ifmt:' conflict
 
                        }
-                       if (-f $input_path) {
+                       my $devfd = $lei->path_to_fd($input_path) // return;
+                       if ($devfd >= 0 || (-f $input_path || -p _)) {
                                require PublicInbox::MboxLock;
                                require PublicInbox::MboxReader;
                                PublicInbox::MboxReader->reads($ifmt) or return
                                        $lei->fail("$ifmt not supported");
-                       } elsif (-d _) {
+                       } elsif (-d $input_path) {
                                require PublicInbox::MdirReader;
                                $ifmt eq 'maildir' or return
                                        $lei->fail("$ifmt not supported");
                        } else {
                                return $lei->fail("Unable to handle $input");
                        }
-               } elsif (-f $input) { push @f, $input }
-               elsif (-d _) { push @d, $input }
-               else { return $lei->fail("Unable to handle $input") }
+               } else {
+                       my $devfd = $lei->path_to_fd($input) // return;
+                       if ($devfd >= 0 || -f $input || -p _) {
+                               push @f, $input
+                       } elsif (-d $input) {
+                               push @d, $input
+                       } else {
+                               return $lei->fail("Unable to handle $input")
+                       }
+               }
        }
        if (@f) { check_input_format($lei, \@f) or return }
        if (@d) { # TODO: check for MH vs Maildir, here
--
unsubscribe: one-click, see List-Unsubscribe header
archive: https://public-inbox.org/meta/

Reply via email to