Mercurial > hg
comparison contrib/chg/chg.c @ 28863:6e06fbee9244
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.
author | Jun Wu <quark@fb.com> |
---|---|
date | Sun, 10 Apr 2016 22:00:34 +0100 |
parents | 0d530299acf2 |
children | b89e4457fa86 |
comparison
equal
deleted
inserted
replaced
28862:39130afcce60 | 28863:6e06fbee9244 |
---|---|
267 abortmsg("timed out waiting for cmdserver %s", opts->sockname); | 267 abortmsg("timed out waiting for cmdserver %s", opts->sockname); |
268 return NULL; | 268 return NULL; |
269 | 269 |
270 cleanup: | 270 cleanup: |
271 if (WIFEXITED(pst)) { | 271 if (WIFEXITED(pst)) { |
272 if (WEXITSTATUS(pst) == 0) | |
273 abortmsg("could not connect to cmdserver " | |
274 "(exited with status 0)"); | |
272 debugmsg("cmdserver exited with status %d", WEXITSTATUS(pst)); | 275 debugmsg("cmdserver exited with status %d", WEXITSTATUS(pst)); |
273 exit(WEXITSTATUS(pst)); | 276 exit(WEXITSTATUS(pst)); |
274 } else if (WIFSIGNALED(pst)) { | 277 } else if (WIFSIGNALED(pst)) { |
275 abortmsg("cmdserver killed by signal %d", WTERMSIG(pst)); | 278 abortmsg("cmdserver killed by signal %d", WTERMSIG(pst)); |
276 } else { | 279 } else { |