Changeset - 07963dd1f0f1
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 15 years ago 2011-04-02 00:42:17
marcin@python-works.com
fixes for issue #133
2 files changed with 17 insertions and 1 deletions:
0 comments (0 inline, 0 general)
rhodecode/__init__.py
Show inline comments
 
@@ -32,6 +32,9 @@ __version__ = '.'.join((str(each) for ea
 
__dbversion__ = 3 #defines current db version for migrations
 
__platform__ = platform.system()
 

	
 
PLATFORM_WIN = ('Windows',)
 
PLATFORM_OTHERS = ('Linux', 'Darwin', 'FreeBSD',)
 

	
 
try:
 
    from rhodecode.lib.utils import get_current_revision
 
    _rev = get_current_revision()
rhodecode/lib/pidlock.py
Show inline comments
 
@@ -4,6 +4,19 @@ from warnings import warn
 
from multiprocessing.util import Finalize
 
import errno
 

	
 
from rhodecode import __platform__, PLATFORM_WIN
 

	
 
if __platform__ in PLATFORM_WIN:
 
    import ctypes
 
    def kill(pid):
 
        """kill function for Win32"""
 
        kernel32 = ctypes.windll.kernel32
 
        handle = kernel32.OpenProcess(1, 0, pid)
 
        return (0 != kernel32.TerminateProcess(handle, 0))
 

	
 
else:
 
    kill = os.kill
 

	
 
class LockHeld(Exception):pass
 

	
 

	
 
@@ -68,7 +81,7 @@ class DaemonLock(object):
 
            # process PID
 
            if running_pid:
 
                try:
 
                    os.kill(running_pid, 0)
 
                    kill(running_pid, 0)
 
                except OSError, exc:
 
                    if exc.errno in (errno.ESRCH, errno.EPERM):
 
                        print "Lock File is there but the program is not running"
0 comments (0 inline, 0 general)