[PATCH 4 of 5] chg: do not redirect stdout to /dev/null

Jun Wu quark at fb.com
Mon Mar 14 16:33:50 EDT 2016


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1457967925 0
#      Mon Mar 14 15:05:25 2016 +0000
# Node ID 5569c3510113e4224cd630cf157a02646ce238d4
# Parent  d931d9d34b74ae2d4ed16737c98bfe6b56ec79e5
chg: do not redirect stdout to /dev/null

Redirecting stdout to /dev/null has unwanted side effects, namely ui.write
will stop working. This patch removes the redirection code and helps chg to
pass test-bad-extension.t.

diff --git a/contrib/chg/chg.c b/contrib/chg/chg.c
--- a/contrib/chg/chg.c
+++ b/contrib/chg/chg.c
@@ -294,12 +294,6 @@
 	if (pid == 0) {
 		/* do not leak lockfd to hg */
 		close(opts->lockfd);
-		/* bypass uisetup() of pager extension */
-		int nullfd = open("/dev/null", O_WRONLY);
-		if (nullfd >= 0) {
-			dup2(nullfd, fileno(stdout));
-			close(nullfd);
-		}
 		execcmdserver(opts);
 	} else {
 		hgc = retryconnectcmdserver(opts, pid);


More information about the Mercurial-devel mailing list