summaryrefslogtreecommitdiffstats
path: root/server.c
diff options
context:
space:
mode:
authornicm <nicm>2017-04-20 09:20:22 +0000
committernicm <nicm>2017-04-20 09:20:22 +0000
commit0b44ad99b51606a8cab662e04cf043a8c4a3ca92 (patch)
tree06a3c095e0babd541df00c9cd80bac898724c984 /server.c
parentf184c6f06c8bd63390ecec3fbe290b087f995ea7 (diff)
If a #() command doesn't exit, use its most recent line of output (it
must be a full line). Don't let it redraw the status line more than once a second. Requested by someone about 10 years ago...
Diffstat (limited to 'server.c')
-rw-r--r--server.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/server.c b/server.c
index 0ce90db6..70f1a76f 100644
--- a/server.c
+++ b/server.c
@@ -134,7 +134,8 @@ server_create_socket(void)
int
server_start(struct event_base *base, int lockfd, char *lockfile)
{
- int pair[2];
+ int pair[2];
+ struct job *job;
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pair) != 0)
fatal("socketpair failed");
@@ -180,6 +181,12 @@ server_start(struct event_base *base, int lockfd, char *lockfile)
server_add_accept(0);
proc_loop(server_proc, server_loop);
+
+ LIST_FOREACH(job, &all_jobs, entry) {
+ if (job->pid != -1)
+ kill(job->pid, SIGTERM);
+ }
+
status_prompt_save_history();
exit(0);
}
@@ -400,7 +407,7 @@ server_child_exited(pid_t pid, int status)
}
}
- LIST_FOREACH(job, &all_jobs, lentry) {
+ LIST_FOREACH(job, &all_jobs, entry) {
if (pid == job->pid) {
job_died(job, status); /* might free job */
break;