[PATCH stable] chg: forward SIGWINCH to worker

Jun Wu quark at fb.com
Sat Apr 16 23:22:23 UTC 2016


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1460248132 -3600
#      Sun Apr 10 01:28:52 2016 +0100
# Node ID 9e798e2ead7cc52a8a199d2ef89cf05fc6af5645
# Parent  7b008530793234393f512275ebca12df4d9fd394
chg: forward SIGWINCH to worker

Before this patch, if the user uses chg and ncurses interface, resizing the
terminal window will mess up its content.

This patch fixes the issue by forwarding SIGWINCH to the worker process.

diff --git a/contrib/chg/chg.c b/contrib/chg/chg.c
--- a/contrib/chg/chg.c
+++ b/contrib/chg/chg.c
@@ -397,6 +397,10 @@
 	if (sigaction(SIGTERM, &sa, NULL) < 0)
 		goto error;
 
+	/* notify the worker about window resize events */
+	sa.sa_flags = SA_RESTART;
+	if (sigaction(SIGWINCH, &sa, NULL) < 0)
+		goto error;
 	/* propagate job control requests to worker */
 	sa.sa_handler = forwardsignal;
 	sa.sa_flags = SA_RESTART;


More information about the Mercurial-devel mailing list