From 0b44ad99b51606a8cab662e04cf043a8c4a3ca92 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 20 Apr 2017 09:20:22 +0000 Subject: 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... --- server.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'server.c') 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; -- cgit