]> Sergey Matveev's repositories - public-inbox.git/commitdiff
watch: imap: be quiet about disconnecting on quit
authorEric Wong <e@yhbt.net>
Sat, 27 Jun 2020 10:03:49 +0000 (10:03 +0000)
committerEric Wong <e@yhbt.net>
Sun, 28 Jun 2020 22:27:25 +0000 (22:27 +0000)
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

index 05aa6594147dd37df0f16085d49b33da4ad4ddac..e4106490c27a7f28825971a38b87635d4a635766 100644 (file)
@@ -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 $@;
+               }
        }
 }