[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-readline] [PATCH] handle winch without waiting for subsequent input

From: Devin J. Pohly
Subject: [Bug-readline] [PATCH] handle winch without waiting for subsequent input
Date: Thu, 15 Jan 2015 13:27:06 -0500

Using SA_RESTART for SIGWINCH was preventing a winch from taking effect
until after the read() in rl_getc() completes - registered handlers are
not run, and Readline's internal terminal dimensions are not updated,
until the next character of input is read.

Since Readline handles EINTR, the automatic restart shouldn't be needed.

To reproduce:
1. Start a Bash shell and `trap "echo foo" WINCH'.
2. Send a SIGWINCH to the shell process.

Expected results:
foo is printed

Actual results:
foo is not printed until after the next keypress
 signals.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/signals.c b/signals.c
index 61f02f9..dd9d75b 100644
--- a/signals.c
+++ b/signals.c
@@ -324,11 +324,7 @@ rl_set_sighandler (sig, handler, ohandler)
   struct sigaction act;
   act.sa_handler = handler;
-#  if defined (SIGWINCH)
-  act.sa_flags = (sig == SIGWINCH) ? SA_RESTART : 0;
-#  else
   act.sa_flags = 0;
-#  endif /* SIGWINCH */
   sigemptyset (&act.sa_mask);
   sigemptyset (&ohandler->sa_mask);
   sigaction (sig, &act, &old_handler);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]