mailr2545 - /1.2/processes.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on September 01, 2006 - 12:59:
Author: bugman
Date: Fri Sep  1 12:59:17 2006
New Revision: 2545

URL: http://svn.gna.org/viewcvs/relax?rev=2545&view=rev
Log:
Added a try statement to catch the ImportError failure of the 'kill' function 
of the 'os' module.

This is a fix for bug #6841 
(https://gna.org/bugs/?func=detailitem&item_id=6841) which was reported
by Daniel Perez in the post at 
https://mail.gna.org/public/relax-users/2006-09/msg00000.html
(Message-id: <44F7FFCF.4060102@xxxxxxxxxxxxxxxx>).

This import statement fails under MS Windows as the 'kill' function is UNIX 
only.  


Modified:
    1.2/processes.py

Modified: 1.2/processes.py
URL: 
http://svn.gna.org/viewcvs/relax/1.2/processes.py?rev=2545&r1=2544&r2=2545&view=diff
==============================================================================
--- 1.2/processes.py (original)
+++ 1.2/processes.py Fri Sep  1 12:59:17 2006
@@ -20,8 +20,16 @@
 #                                                                            
 #
 
###############################################################################
 
-from os import kill, popen3, system
+from os import popen3, system
 from popen2 import Popen3
+
+# UNIX only module.
+try:
+    from os import kill
+    kill_module = 1
+except ImportError:
+    kill_module = 0
+
 
 
 class RelaxPopen3(Popen3):
@@ -40,10 +48,11 @@
             return
 
         # Kill the child process (or pass silently if the PID no longer 
exists).
-        try:
-            kill(self.pid, sig)
-        except:
-            pass
+        if kill_module:
+            try:
+                kill(self.pid, sig)
+            except:
+                pass
 
         # Kill the relax process spawned by the thread.
         if hasattr(self, 'relax_pid') and self.relax_pid != None:




Related Messages


Powered by MHonArc, Updated Fri Sep 01 13:20:04 2006