[GRASS-SVN] r43691 - grass/branches/releasebranch_6_4/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Sep 26 07:36:21 EDT 2010


Author: marisn
Date: 2010-09-26 11:36:21 +0000 (Sun, 26 Sep 2010)
New Revision: 43691

Modified:
   grass/branches/releasebranch_6_4/lib/init/init.sh
Log:
Close any open gis.m sessions on exit (Merge from develbranch_6)

Modified: grass/branches/releasebranch_6_4/lib/init/init.sh
===================================================================
--- grass/branches/releasebranch_6_4/lib/init/init.sh	2010-09-26 11:30:27 UTC (rev 43690)
+++ grass/branches/releasebranch_6_4/lib/init/init.sh	2010-09-26 11:36:21 UTC (rev 43691)
@@ -819,7 +819,10 @@
     
     # Check for tcltk interface
     tcltk | gis.m)
-	"$GISBASE/scripts/gis.m"
+       if [ "$sh" != "bash" ] && [ "$sh" != "msh" ] && [ "$sh" != "cygwin" ]; then
+               # trap is not supported by csh/tcsh and rc
+               "$GISBASE/scripts/gis.m"
+       fi;
 	;;
     oldtcltk | d.m)
 	"$GISBASE/scripts/d.m"
@@ -968,6 +971,11 @@
 
     echo "export PATH=\"$PATH\"" >> "$bashrc"
     echo "export HOME=\"$USERHOME\"" >> "$bashrc" # restore user home path
+    echo 'export GRASS_SHELL_PID=$$' >> "$bashrc" # can be used to terminate GRASS session from GUI
+    if [ "$GRASS_GUI" = tcltk ] || [ "$GRASS_GUI" = gis.m ]; then
+       echo '$GISBASE/scripts/gis.m' >> "$bashrc" # Start gis.m
+    fi;
+    echo 'trap "echo \"GUI issued an exit\"; exit" SIGQUIT' >> "$bashrc"
 
     "$ETC/run" "$SHELL"
     EXIT_VAL=$?
@@ -1017,6 +1025,15 @@
     d.mon stop="$MON"
 done
 
+# Attempt to close any open gis.m instances.
+if [ -n "$TCLTKGRASSBASE" ] && [ `ps -a | grep -c "$GRASS_WISH"` -ge 1 ] ; then
+       echo "Closing open gis.m sessions....."
+       echo 'foreach gwin [lsearch -all -inline [winfo interps] gm_tcl*] {
+               catch {send -async $gwin Gm::remoteExit $env(GIS_LOCK)}
+       }
+       exit' | "$GRASS_WISH" #>/dev/null 2>&1
+fi
+
 echo "Cleaning up temporary files ..."
 
 "$ETC/clean_temp" > /dev/null



More information about the grass-commit mailing list