[PATCH 1 of 2] chg: silently inherit server exit code

Jun Wu quark at fb.com
Fri Mar 11 12:48:58 UTC 2016


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1457664726 0
#      Fri Mar 11 02:52:06 2016 +0000
# Node ID b39cdec1d4e8817cf096474642ad8337d218d126
# Parent  5021398417ed44f7d589879ff74ce9e9eaf20b5b
chg: silently inherit server exit code

If chgserver aborts during startup, for example, error.ParseError when parsing
a config file, chg client probably just wants to exit with a same exit code
without printing other unrelated text. This patch changes the text "cmdserver
exited with status" from abortmsg to debugmsg and exits with a same exit code.

diff --git a/contrib/chg/chg.c b/contrib/chg/chg.c
--- a/contrib/chg/chg.c
+++ b/contrib/chg/chg.c
@@ -252,7 +252,8 @@
 
 cleanup:
 	if (WIFEXITED(pst)) {
-		abortmsg("cmdserver exited with status %d", WEXITSTATUS(pst));
+		debugmsg("cmdserver exited with status %d", WEXITSTATUS(pst));
+		exit(WEXITSTATUS(pst));
 	} else if (WIFSIGNALED(pst)) {
 		abortmsg("cmdserver killed by signal %d", WTERMSIG(pst));
 	} else {


More information about the Mercurial-devel mailing list