code P item #526, was opened at 2007-11-03 19:07 Status: Open Priority: 3 Submitted By: Māris Nartišs (marisn) Assigned to: Nobody (None) Summary: Provide option to end GRASS session from gis.m Patch status: None Patch type: enhancement GRASS component: startup GRASS version: CVS HEAD GRASS CVS checkout date, if applies (YYMMDD):
Initial Comment: This patch adds "EXIT GRASS" to gis.m menu. GRASS CLI exit is done by sending SIGINT to GRASS shell. Shell's pid is provided by GRASS_SHELL_PID env variable. Works and is tested on bash. tcsh/csh requires a small change (I don't have tcsh to make tests how onint works). May also work with ksh. Will NOT work with rc. This implementation also includes code from patch #515. How it works (in bash): GRASS_SHELL_PID is set from .bashrc on GRASS shell startup; gis.m is also launched from .bashrc and NOT from init.sh; gis.m "EXIT GRASS" calls Gm::quit true to indicate full exit; Gm::quit checks GRASS_SHELL_PID presence and sends SIGINT; GRASS shell traps SIGINT signal and issues exit from GRASS shell; init.sh cleans up any open gis.m instances et.al. To add other shell support, shell must provide a way: 1) how to get process PID (echo $$); 2) how to trap SIGINT (trap "exit" SIGINT); 3) how to launch gis.m after shell startup from init.sh (.bashrc); 4) how to send signal to other process. This code may require aditional tweaks before can be commited. ---------------------------------------------------------------------- You can respond by visiting: http://wald.intevation.org/tracker/?func=detail&atid=205&aid=526&group_id=21 _______________________________________________ grass-dev mailing list grass-dev@grass.itc.it http://grass.itc.it/mailman/listinfo/grass-dev