changeset 2568:29e999f26998 beta

pidlock always create dirs for lock file
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 07 Jul 2012 13:43:16 +0200
parents 5fe0f744bec0
children b98fd6fc67f9
files rhodecode/lib/pidlock.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/pidlock.py	Fri Jul 06 20:29:36 2012 +0200
+++ b/rhodecode/lib/pidlock.py	Sat Jul 07 13:43:16 2012 +0200
@@ -8,6 +8,7 @@
 
 from rhodecode.lib.compat import kill
 
+
 class LockHeld(Exception):
     pass
 
@@ -123,6 +124,10 @@
         """
         if self.debug:
             print 'creating a file %s and pid: %s' % (pidfile, lockname)
+
+        dir_, file_ = os.path.split(pidfile)
+        if not os.path.isdir(dir_):
+            os.makedirs(dir_)
         pidfile = open(self.pidfile, "wb")
         pidfile.write(lockname)
         pidfile.close