about summary refs log tree commit homepage
path: root/script/public-inbox-learn
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-12-27 02:53:05 +0000
committerEric Wong <e@80x24.org>2020-12-28 23:19:48 +0000
commit522bb4a4973d4ac41b83be58dd3257e8cd038744 (patch)
tree4ff707e12c1520ac6c8b80249bde1be4ee76250e /script/public-inbox-learn
parent0f545dd95ca88e69f011aa56d07494887e7df822 (diff)
downloadpublic-inbox-522bb4a4973d4ac41b83be58dd3257e8cd038744.tar.gz
Reading from regular files (even on STDIN) can fail
when dealing with flakey storage.
Diffstat (limited to 'script/public-inbox-learn')
-rwxr-xr-xscript/public-inbox-learn3
1 files changed, 1 insertions, 2 deletions
diff --git a/script/public-inbox-learn b/script/public-inbox-learn
index 9352c8ff..1731a4ba 100755
--- a/script/public-inbox-learn
+++ b/script/public-inbox-learn
@@ -39,8 +39,7 @@ my $spamc = PublicInbox::Spamcheck::Spamc->new;
 my $pi_cfg = PublicInbox::Config->new;
 my $err;
 my $mime = PublicInbox::Eml->new(do{
-        local $/;
-        my $data = <STDIN>;
+        defined(my $data = do { local $/; <STDIN> }) or die "read STDIN: $!\n";
         $data =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s;
 
         if ($train ne 'rm') {