From 462860480ac00a7958daa2a590bfdb5f4fde4147 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 23 May 2016 01:00:15 +0000 Subject: daemon: ignore SIGWINCH when connected to terminal Users may change terminal sizes if the process is connected to a terminal, so we can't reasonably expect SIGWINCH to work as intended. --- lib/PublicInbox/Daemon.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib') 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); -- cgit v1.2.3-24-ge0c7