changeset 1549:d6cb805c92fd beta

moved kill function to compat
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 11 Oct 2011 20:59:41 -0500
parents cba42a9e9164
children 6f468ba37650
files rhodecode/lib/compat.py rhodecode/lib/pidlock.py
diffstat 2 files changed, 20 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/compat.py	Wed Oct 12 00:29:13 2011 +0200
+++ b/rhodecode/lib/compat.py	Tue Oct 11 20:59:41 2011 -0500
@@ -24,6 +24,9 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+import os
+from rhodecode import __platform__, PLATFORM_WIN
+
 #==============================================================================
 # json
 #==============================================================================
@@ -358,3 +361,19 @@
 # OrderedSet
 #==============================================================================
 from sqlalchemy.util import OrderedSet
+
+
+#==============================================================================
+# kill FUNCTIONS
+#==============================================================================
+if __platform__ in PLATFORM_WIN:
+    import ctypes
+
+    def kill(pid, sig):
+        """kill function for Win32"""
+        kernel32 = ctypes.windll.kernel32
+        handle = kernel32.OpenProcess(1, 0, pid)
+        return (0 != kernel32.TerminateProcess(handle, 0))
+
+else:
+    kill = os.kill
--- a/rhodecode/lib/pidlock.py	Wed Oct 12 00:29:13 2011 +0200
+++ b/rhodecode/lib/pidlock.py	Tue Oct 11 20:59:41 2011 -0500
@@ -6,20 +6,7 @@
 from warnings import warn
 from multiprocessing.util import Finalize
 
-from rhodecode import __platform__, PLATFORM_WIN
-
-if __platform__ in PLATFORM_WIN:
-    import ctypes
-
-    def kill(pid, sig):
-        """kill function for Win32"""
-        kernel32 = ctypes.windll.kernel32
-        handle = kernel32.OpenProcess(1, 0, pid)
-        return (0 != kernel32.TerminateProcess(handle, 0))
-
-else:
-    kill = os.kill
-
+from rhodecode.lib.compat import kill
 
 class LockHeld(Exception):
     pass