##// END OF EJS Templates
chg: reset signal handlers to default before waiting pager...
Yuya Nishihara -
r29369:85a18f3c default
parent child Browse files
Show More
@@ -423,6 +423,35 b' error:'
423 abortmsgerrno("failed to set up signal handlers");
423 abortmsgerrno("failed to set up signal handlers");
424 }
424 }
425
425
426 static void restoresignalhandler()
427 {
428 struct sigaction sa;
429 memset(&sa, 0, sizeof(sa));
430 sa.sa_handler = SIG_DFL;
431 sa.sa_flags = SA_RESTART;
432 if (sigemptyset(&sa.sa_mask) < 0)
433 goto error;
434
435 if (sigaction(SIGHUP, &sa, NULL) < 0)
436 goto error;
437 if (sigaction(SIGINT, &sa, NULL) < 0)
438 goto error;
439 if (sigaction(SIGTERM, &sa, NULL) < 0)
440 goto error;
441 if (sigaction(SIGWINCH, &sa, NULL) < 0)
442 goto error;
443 if (sigaction(SIGCONT, &sa, NULL) < 0)
444 goto error;
445 if (sigaction(SIGTSTP, &sa, NULL) < 0)
446 goto error;
447
448 peerpid = 0;
449 return;
450
451 error:
452 abortmsgerrno("failed to restore signal handlers");
453 }
454
426 /* This implementation is based on hgext/pager.py (post 369741ef7253)
455 /* This implementation is based on hgext/pager.py (post 369741ef7253)
427 * Return 0 if pager is not started, or pid of the pager */
456 * Return 0 if pager is not started, or pid of the pager */
428 static pid_t setuppager(hgclient_t *hgc, const char *const args[],
457 static pid_t setuppager(hgclient_t *hgc, const char *const args[],
@@ -608,6 +637,7 b' int main(int argc, const char *argv[], c'
608 setupsignalhandler(hgc_peerpid(hgc));
637 setupsignalhandler(hgc_peerpid(hgc));
609 pid_t pagerpid = setuppager(hgc, argv + 1, argc - 1);
638 pid_t pagerpid = setuppager(hgc, argv + 1, argc - 1);
610 int exitcode = hgc_runcommand(hgc, argv + 1, argc - 1);
639 int exitcode = hgc_runcommand(hgc, argv + 1, argc - 1);
640 restoresignalhandler();
611 hgc_close(hgc);
641 hgc_close(hgc);
612 freecmdserveropts(&opts);
642 freecmdserveropts(&opts);
613 if (pagerpid)
643 if (pagerpid)
General Comments 0
You need to be logged in to leave comments. Login now