Changeset - d6cb805c92fd
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 14 years ago 2011-10-12 03:59:41
marcin@python-works.com
moved kill function to compat
2 files changed with 20 insertions and 14 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/compat.py
Show inline comments
 
@@ -21,12 +21,15 @@
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# 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
 
#==============================================================================
 
try:
 
    import json
 
except ImportError:
 
@@ -355,6 +358,22 @@ 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
rhodecode/lib/pidlock.py
Show inline comments
 
@@ -3,26 +3,13 @@ import sys
 
import time
 
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
 

	
 

	
 
class DaemonLock(object):
0 comments (0 inline, 0 general)