More signal handling, this time for when running the game.

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@571 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Pasi Kallinen 2010-05-16 19:14:35 +00:00
parent d623b5c0d6
commit eb91e63f77
1 changed files with 12 additions and 6 deletions

View File

@ -346,7 +346,6 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me)
clear();
refresh();
endwin ();
signal(SIGWINCH, SIG_DFL);
/* first run the generic "do these when a game is started" commands */
dgl_exec_cmdqueue(globalconfig.cmdqueue[DGLTIME_GAMESTART], userchoice, me);
@ -360,17 +359,24 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me)
myconfig[userchoice]->bin_args[i] = tmpstr;
}
signals_block();
signal(SIGWINCH, SIG_DFL);
signal(SIGINT, SIG_DFL);
signal(SIGQUIT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
idle_alarm_set_enabled(0);
/* launch program */
ttyrec_main (userchoice, me->username,
dgl_format_str(userchoice, me, myconfig[userchoice]->ttyrecdir, NULL),
gen_ttyrec_filename());
/* lastly, run the generic "do these when a game is left" commands */
dgl_exec_cmdqueue(globalconfig.cmdqueue[DGLTIME_GAMEEND], userchoice, me);
idle_alarm_set_enabled(1);
signals_release();
/* lastly, run the generic "do these when a game is left" commands */
signal (SIGHUP, catch_sighup);
signal (SIGINT, catch_sighup);
signal (SIGQUIT, catch_sighup);
signal (SIGTERM, catch_sighup);
signal(SIGWINCH, sigwinch_func);
dgl_exec_cmdqueue(globalconfig.cmdqueue[DGLTIME_GAMEEND], userchoice, me);
setproctitle ("%s", me->username);
initcurses ();