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

login
register
mail settings
Submitter Jun Wu
Date March 14, 2016, 8:33 p.m.
Message ID <5569c3510113e4224cd6.1457987630@x1c>
Download mbox | patch
Permalink /patch/13887/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Jun Wu - March 14, 2016, 8:33 p.m.
# HG changeset patch
# User Jun Wu <quark@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.
Yuya Nishihara - March 18, 2016, 10:36 p.m.
On Mon, 14 Mar 2016 20:33:50 +0000, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark@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

And finally queued this after the pager patch, thanks.

Patch

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);