diff contrib/chg/hgclient.c @ 28551:8e5312f8df30

chg: downgrade "failed to read channel" from abortmsg to debugmsg If the server has an uncaught exception, it will exit without being able to write the channel information. In this case, the client is likely to complain about "failed to read channel", which looks inconsistent with original hg. This patch silences the error message and makes uncaught exception behavior more like original hg. It will help chg to pass test-fileset.t.
author Jun Wu <quark@fb.com>
date Mon, 14 Mar 2016 23:28:14 +0000
parents aa082a8125da
children 222f482930c8
line wrap: on
line diff
--- a/contrib/chg/hgclient.c	Tue Mar 15 00:42:33 2016 +0000
+++ b/contrib/chg/hgclient.c	Mon Mar 14 23:28:14 2016 +0000
@@ -106,8 +106,11 @@
 	assert(hgc);
 
 	ssize_t rsize = recv(hgc->sockfd, &hgc->ctx.ch, sizeof(hgc->ctx.ch), 0);
-	if (rsize != sizeof(hgc->ctx.ch))
-		abortmsg("failed to read channel");
+	if (rsize != sizeof(hgc->ctx.ch)) {
+		/* server would have exception and traceback would be printed */
+		debugmsg("failed to read channel");
+		exit(255);
+	}
 
 	uint32_t datasize_n;
 	rsize = recv(hgc->sockfd, &datasize_n, sizeof(datasize_n), 0);