[orca] Fix for bgo#618285 - Orca -q and --replace should quit gracefully using kill.



commit 116a024ec5da22c406f6700e16c71ad0e0477cd9
Author: Mesar Hameed <mhameed src gnome org>
Date:   Mon May 17 11:33:35 2010 +0100

    Fix for bgo#618285 - Orca -q and --replace should quit gracefully using kill.

 src/orca/gnomespeechfactory.py |    4 ++--
 src/orca/orca.in               |   17 ++++++++++++++++-
 src/orca/orca.py               |    9 +++++++++
 3 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/gnomespeechfactory.py b/src/orca/gnomespeechfactory.py
index f098bdc..c34b4b1 100644
--- a/src/orca/gnomespeechfactory.py
+++ b/src/orca/gnomespeechfactory.py
@@ -970,8 +970,8 @@ class SpeechServer(speechserver.SpeechServer):
             # On failure, remember what we said, reset our connection to the
             # speech synthesis driver, and try to say it again.
             #
-            debug.printException(debug.LEVEL_SEVERE)
-            debug.println(debug.LEVEL_SEVERE, "Restarting speech...")
+            debug.printException(debug.LEVEL_WARNING)
+            debug.println(debug.LEVEL_WARNING, "Restarting speech...")
             self.reset()
             return -1
 
diff --git a/src/orca/orca.in b/src/orca/orca.in
index 6041869..e86c7f3 100644
--- a/src/orca/orca.in
+++ b/src/orca/orca.in
@@ -83,6 +83,16 @@ restoreXmodmap()
 #
 cleanup()
 {
+
+    # Check if we should force orca to quit, or just ask it nicely.
+    # kill -15, will give orca time to shutdown gracefully
+    # kill -9 will terminate immediately
+    if test "$1" = "-f"; then
+        KILLARG=-9
+    else
+        KILLARG=-15
+    fi
+
     USERID=`id | cut -f2 -d= | cut -f1 -d\(`
     PIDS=`ps -eo pid,ruid,args | grep $USERID | \
         egrep "orca[.]orca|OAFIID[:]GNOME_Speech|OAFIID[:]GNOME_Magnifier|festival [-][-]server"|\
@@ -91,7 +101,7 @@ cleanup()
     '
     PIDS=`echo $PIDS`
     if [ "x$PIDS" != "x" ] ; then
-        kill -9 $PIDS > /dev/null 2>&1
+        kill $KILLARG $PIDS > /dev/null 2>&1
     fi
     restoreXmodmap
 }
@@ -143,6 +153,11 @@ if [ `echo $ARGS | grep -c "\-q"` -gt 0 ] ; then
     # existing orca process to quit.  So, we just do a cleanup.
     #
     cleanup
+elif [ `echo $ARGS | grep -c "\-f"` -gt 0 ] ; then
+    # If the user has done -f or --forcequit, that means 
+    # that Orca has probably hung badly, and needs to be killed with force.
+    #
+    cleanup "-f"
 else
     # Allow a --replace to kill other orca processes.
     #
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 13e2546..ea8ca26 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -1544,6 +1544,15 @@ def usage():
     print "-q, --quit                   " + \
           _("Quits Orca (if shell script used)")
 
+    # Translators: this is the Orca command line option that will force 
+    # the termination of Orca.
+    # The user would run the Orca shell script again from a terminal window.
+    # If this command line option is specified, the script will quit any
+    # instances of Orca that are already running.
+    #
+    print "-f, --forcequit              " + \
+          _("Forces orca to be terminated immediately.")
+
     # Translators: this is the Orca command line option to tell Orca to
     # replace any existing Orca process(es) that might be running.
     #



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]