If ->idle_done was handled successfully, we can just
let normal ->DESTROY disconnect and avoid ugly backtraces
when a user hits Ctrl-C to take down the process group.
---
 lib/PublicInbox/WatchMaildir.pm | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm
index 05aa6594147..e4106490c27 100644
--- a/lib/PublicInbox/WatchMaildir.pm
+++ b/lib/PublicInbox/WatchMaildir.pm
@@ -208,9 +208,11 @@ sub quit {
        }
        if (my $idle_mic = $self->{idle_mic}) {
                eval { $idle_mic->done };
-               warn "IDLE DONE error: $@\n" if $@;
-               eval { $idle_mic->disconnect };
-               warn "IDLE LOGOUT error: $@\n" if $@;
+               if ($@) {
+                       warn "IDLE DONE error: $@\n";
+                       eval { $idle_mic->disconnect };
+                       warn "IDLE LOGOUT error: $@\n" if $@;
+               }
        }
 }
 
--
unsubscribe: one-click, see List-Unsubscribe header
archive: https://public-inbox.org/meta/

Reply via email to