diff --git a/rhodecode/lib/compat.py b/rhodecode/lib/compat.py --- a/rhodecode/lib/compat.py +++ b/rhodecode/lib/compat.py @@ -24,6 +24,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import os +from rhodecode import __platform__, PLATFORM_WIN + #============================================================================== # json #============================================================================== @@ -358,3 +361,19 @@ class OrderedDict(_odict, dict): # 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 diff --git a/rhodecode/lib/pidlock.py b/rhodecode/lib/pidlock.py --- a/rhodecode/lib/pidlock.py +++ b/rhodecode/lib/pidlock.py @@ -6,20 +6,7 @@ import errno 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