aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2016-02-08 17:35:07 -0600
committerPeter Seebach <peter.seebach@windriver.com>2016-02-08 17:35:07 -0600
commit19cbd2fa183df2e15da8e848f994422722c38f02 (patch)
tree76754bd138d75c774a68fbfa4e2a00698752895d
parentf0d2cb7bb944b7086ba86547bbb9a33ce7745ba6 (diff)
downloadpseudo-19cbd2fa183df2e15da8e848f994422722c38f02.tar.gz
pseudo-19cbd2fa183df2e15da8e848f994422722c38f02.tar.bz2
pseudo-19cbd2fa183df2e15da8e848f994422722c38f02.zip
improve abort handling
First, if aborting, display message even when no debugging is set, because that's probably a big deal. Second, if you use "pseudo <cmd>", try to die with the same signal that killed the child process, if it died from a signal rather than exiting cleanly. (You can't just pass the exit status out in that case, because exit(N) doesn't work for N outside the range of non-signal exit statuses.)
-rw-r--r--ChangeLog.txt1
-rw-r--r--pseudo.c9
-rw-r--r--pseudo_client.c2
3 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 30e5d02..5e6d670 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -2,6 +2,7 @@
* (seebs) require -S to shutdown server when running a command.
* (seebs) improve logic for server shutdowns, increase short timeout
* (seebs) rework client server-spawning logic significantly
+ * (seebs) make abort messages make it out, display message on abort
2016-02-05:
* (seebs) don't abort search for server on first try.
diff --git a/pseudo.c b/pseudo.c
index 8cf946b..4451992 100644
--- a/pseudo.c
+++ b/pseudo.c
@@ -422,7 +422,14 @@ main(int argc, char *argv[]) {
if (opt_S) {
pseudo_client_shutdown();
}
- return WEXITSTATUS(rc);
+ if (WIFEXITED(rc)) {
+ return WEXITSTATUS(rc);
+ } else if (WIFSIGNALED(rc)) {
+ kill(getpid(), WTERMSIG(rc));
+ exit(1);
+ } else {
+ exit(1);
+ }
} else {
rc = execv(fullpath, argv);
if (rc == -1) {
diff --git a/pseudo_client.c b/pseudo_client.c
index 00d18d0..b02657f 100644
--- a/pseudo_client.c
+++ b/pseudo_client.c
@@ -1270,7 +1270,7 @@ pseudo_client_request(pseudo_msg_t *msg, size_t len, const char *path) {
return 0;
}
}
- pseudo_debug(PDBGF_CLIENT, "server connection persistently failed, aborting.\n");
+ pseudo_diag("pseudo: server connection persistently failed, aborting.\n");
abort();
return 0;
}