about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2017-06-26 17:44:41 +0000
committerEric Wong <e@80x24.org>2017-06-26 17:44:41 +0000
commit9ae2454c474b8984235ef7607efc585f8a50f2bc (patch)
tree767a8b5ccbcf87038002a7939ad1e8f1a3ce8b13
parent2ee3659062bf96f8360292c38738a517a802f11e (diff)
downloadpublic-inbox-9ae2454c474b8984235ef7607efc585f8a50f2bc.tar.gz
We must not trigger future activity when initializing
a -watch shutdown.
-rw-r--r--lib/PublicInbox/WatchMaildir.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm
index 8e10e43f..5ae3d21f 100644
--- a/lib/PublicInbox/WatchMaildir.pm
+++ b/lib/PublicInbox/WatchMaildir.pm
@@ -225,7 +225,7 @@ sub watch {
 
 sub trigger_scan {
         my ($self, $base) = @_;
-        my $dir = $self->{scandir} or die "not watch-ing, yet\n";
+        my $dir = $self->{scandir} or return;
         open my $fh, '>', "$dir/$base" or die "open $dir/$base failed: $!\n";
         close $fh or die "close $dir/$base failed: $!\n";
 }
@@ -235,6 +235,7 @@ sub scan {
         if ($path =~ /quit\z/) {
                 %{$self->{opendirs}} = ();
                 _done_for_now($self);
+                delete $self->{scandir};
                 $self->{quit} = 1;
                 return;
         }