# HG changeset patch # User Jun Wu # Date 2016-04-10 21:00:34 # Node ID 6e06fbee9244dcfaa75bebe848913e4ab09ad54c # Parent 39130afcce602f6230f8f5c83f3c524a60a830bb chg: server exited with code 0 without being connectable is an error Before this patch, if the server started by chg has exited with code 0 without creating a connectable unix domain socket at the specified address, chg will exit with code 0, which is not the correct behavior. It can happen, for example, CHGHG is set to /bin/true. This patch addresses the issue by checking the exit code of the server and printing a new error message if the server exited normally but cannot be reached. diff --git a/contrib/chg/chg.c b/contrib/chg/chg.c --- a/contrib/chg/chg.c +++ b/contrib/chg/chg.c @@ -269,6 +269,9 @@ static hgclient_t *retryconnectcmdserver cleanup: if (WIFEXITED(pst)) { + if (WEXITSTATUS(pst) == 0) + abortmsg("could not connect to cmdserver " + "(exited with status 0)"); debugmsg("cmdserver exited with status %d", WEXITSTATUS(pst)); exit(WEXITSTATUS(pst)); } else if (WIFSIGNALED(pst)) {