Improve signal handling and leaving/entering curses.
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@570 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
725b6cd1d2
commit
d623b5c0d6
|
@ -1973,6 +1973,8 @@ editoptions (int game)
|
|||
myargv[1] = dgl_format_str(game, me, myconfig[game]->rc_fmt, NULL);
|
||||
myargv[2] = 0;
|
||||
|
||||
clear();
|
||||
refresh();
|
||||
endwin ();
|
||||
|
||||
editor = fork();
|
||||
|
@ -1985,12 +1987,15 @@ editoptions (int game)
|
|||
}
|
||||
else if (editor == 0)
|
||||
{
|
||||
signals_block();
|
||||
editor_main (2, myargv);
|
||||
signals_release();
|
||||
exit(0);
|
||||
}
|
||||
else
|
||||
waitpid(editor, NULL, 0);
|
||||
|
||||
initcurses();
|
||||
refresh ();
|
||||
check_retard(1);
|
||||
}
|
||||
|
|
|
@ -263,6 +263,8 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me)
|
|||
myargv[1] = p2;
|
||||
myargv[2] = 0;
|
||||
|
||||
clear();
|
||||
refresh();
|
||||
endwin();
|
||||
idle_alarm_set_enabled(0);
|
||||
child = fork();
|
||||
|
@ -271,11 +273,14 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me)
|
|||
debug_write("exec-command fork failed");
|
||||
graceful_exit(114);
|
||||
} else if (child == 0) {
|
||||
signals_block();
|
||||
execvp(p1, myargv);
|
||||
signals_release();
|
||||
exit(0);
|
||||
} else
|
||||
waitpid(child, NULL, 0);
|
||||
idle_alarm_set_enabled(1);
|
||||
initcurses();
|
||||
refresh();
|
||||
check_retard(1);
|
||||
}
|
||||
|
@ -338,6 +343,8 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me)
|
|||
|
||||
setproctitle("%s [playing %s]", me->username, myconfig[userchoice]->shortname);
|
||||
|
||||
clear();
|
||||
refresh();
|
||||
endwin ();
|
||||
signal(SIGWINCH, SIG_DFL);
|
||||
|
||||
|
@ -353,6 +360,7 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me)
|
|||
myconfig[userchoice]->bin_args[i] = tmpstr;
|
||||
}
|
||||
|
||||
signals_block();
|
||||
idle_alarm_set_enabled(0);
|
||||
/* launch program */
|
||||
ttyrec_main (userchoice, me->username,
|
||||
|
@ -362,6 +370,7 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me)
|
|||
/* 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();
|
||||
|
||||
setproctitle ("%s", me->username);
|
||||
initcurses ();
|
||||
|
|
Loading…
Reference in New Issue