about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-05-23 01:00:15 +0000
committerEric Wong <e@80x24.org>2016-05-23 01:01:19 +0000
commit462860480ac00a7958daa2a590bfdb5f4fde4147 (patch)
treeb6bc8063937793ce54707b9a5d38e1f7a1f8bc65
parentc24bb049f178bd666981029b97cb982e61e197c6 (diff)
downloadpublic-inbox-462860480ac00a7958daa2a590bfdb5f4fde4147.tar.gz
Users may change terminal sizes if the process is connected to a
terminal, so we can't reasonably expect SIGWINCH to work as
intended.
-rw-r--r--lib/PublicInbox/Daemon.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index 3d895b09..b64ec874 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -375,7 +375,13 @@ sub master_loop {
                                 exit if $quit++;
                                 kill_workers($s);
                         } elsif ($s eq 'WINCH') {
-                                $worker_processes = 0;
+                                if (-t STDIN || -t STDOUT || -t STDERR) {
+                                        warn
+"ignoring SIGWINCH while connected to terminal\n";
+                                        $SIG{WINCH} = 'IGNORE';
+                                } else {
+                                        $worker_processes = 0;
+                                }
                         } elsif ($s eq 'HUP') {
                                 $worker_processes = $set_workers;
                                 kill_workers($s);