From 8128edc7eb1e7a86e82d5936ec1100e1f9912f54 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sat, 8 Feb 2020 17:22:51 -0500 Subject: Handle SIGCHLD --- chat.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'chat.c') diff --git a/chat.c b/chat.c index b3e6825..372cbbd 100644 --- a/chat.c +++ b/chat.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include @@ -141,6 +143,7 @@ int main(int argc, char *argv[]) { signal(SIGHUP, signalHandler); signal(SIGINT, signalHandler); signal(SIGTERM, signalHandler); + signal(SIGCHLD, signalHandler); sig_t cursesWinch = signal(SIGWINCH, signalHandler); struct pollfd fds[2] = { @@ -155,6 +158,25 @@ int main(int argc, char *argv[]) { if (signals[SIGHUP]) self.quit = "zzz"; if (signals[SIGINT] || signals[SIGTERM]) break; + + if (signals[SIGCHLD]) { + int status; + while (0 < waitpid(-1, &status, WNOHANG)) { + if (WIFEXITED(status) && WEXITSTATUS(status)) { + uiFormat( + Network, Warm, NULL, + "Process exits with status %d", WEXITSTATUS(status) + ); + } else if (WIFSIGNALED(status)) { + uiFormat( + Network, Warm, NULL, + "Process terminates from %s", + strsignal(WTERMSIG(status)) + ); + } + } + } + if (signals[SIGWINCH]) { signals[SIGWINCH] = 0; cursesWinch(SIGWINCH); -- cgit 1.4.1 /torus/tree/Darwin.mk?id=89c9c64d7249b5ec77700c1fffdc39e68cf81a86'>tree commit diff homepage
Commit message (Collapse)Author
2020-06-25Use DisableForwarding in sshd_configJune McEnroe
2019-12-19Remove READMEJune McEnroe
2019-12-15Update git URLsJune McEnroe
2019-08-05Add buymeacoffee linkJune McEnroe
Can't hurt, I guess? I don't expect to get anything...
2019-07-27Use braces in MakefileJune McEnroe
2019-07-27Make copyright headers consistentJune McEnroe
2019-07-08Remove NetHack from indexJune McEnroe
2019-04-08Don't install rc.kfcgi eitherJune McEnroe
2019-03-28Remove rc.kfcgiJune McEnroe
I sent a better version of it to the port maintainer and it is now in the ports tree.
2019-01-16Reformat index.html with explore linkJune McEnroe
2019-01-16Return false from keydown handler in exploreJune McEnroe
2019-01-08Draw lines to tile edgeJune McEnroe
2019-01-08Factor out default pathsJune McEnroe
2019-01-08Remove incorrect default coordinatesJune McEnroe
2019-01-07Set img src when explore fragment changesJune McEnroe
2019-01-07Compress PNG data in imageJune McEnroe
kcgi never enables compression for FastCGI.
2019-01-07madvise MADV_NOCORE in imageJune McEnroe
2019-01-07Add license notice to explore JavaScriptJune McEnroe
2019-01-07Add Q/Home binding in exploreJune McEnroe
2019-01-07Fix explore image URLJune McEnroe
2019-01-07Add HOME button, ssh link, AGPL notice to exploreJune McEnroe
2019-01-06Add meta viewport to exploreJune McEnroe
2019-01-06Set background and max-width in exploreJune McEnroe
2019-01-06Swallow writes after the connection is closedJune McEnroe
It was not okay.
2019-01-06Handle KCGI_HUPJune McEnroe
I hope it's okay that I keep writing to the fwopen stream after streamWrite returns -1.
2019-01-06Install html filesJune McEnroe