[orca] Handle versions of python earlier than 3.8 (signal.strsignal)



commit fbb9219f75a61dc3d69db5253456efeb5edfe899
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Feb 8 10:18:18 2021 +0100

    Handle versions of python earlier than 3.8 (signal.strsignal)
    
    Fixes #190.

 src/orca/orca.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 0da11578d..ac80dd0b9 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -714,8 +714,14 @@ exitCount = 0
 def shutdownOnSignal(signum, frame):
     global exitCount
 
-    msg = 'ORCA: Shutting down and exiting due to signal=%d (%s)' % \
-        (signum, signal.strsignal(signum))
+    try:
+        # Requires python 3.8
+        signalString = '(%s)' % signal.strsignal(signum)
+    except:
+        signalString = ''
+
+    msg = 'ORCA: Shutting down and exiting due to signal=%d %s' % \
+        (signum, signalString)
     debug.println(debug.LEVEL_INFO, msg, True)
 
     # Well...we'll try to exit nicely, but if we keep getting called,


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