[Patchew-devel] [PATCH] tester: use different lock files for each instance

Paolo Bonzini pbonzini at redhat.com
Fri Feb 8 18:08:16 UTC 2019


This allows installing multiple tester instances under the same user

Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
 patchew-cli | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/patchew-cli b/patchew-cli
index b2d0bbb..d79c76f 100755
--- a/patchew-cli
+++ b/patchew-cli
@@ -609,8 +609,8 @@ class TesterCommand(SubCommand):
                     shutil.rmtree(wd)
             return True
 
-    def _check_singleton(self):
-        lockfile = os.path.expanduser("~/.patchew-tester.lock")
+    def _check_singleton(self, name):
+        lockfile = os.path.expanduser("~/.%s.lock" % name)
         self._lockfile = open(lockfile, "w+")
         try:
             fcntl.flock(self._lockfile, fcntl.LOCK_EX | fcntl.LOCK_NB)
@@ -632,7 +632,7 @@ class TesterCommand(SubCommand):
                 print(i)
             return 0
         if args.singleton:
-            self._check_singleton()
+            self._check_singleton(args.name or "patchew-tester")
         subprocess.check_output(["git", "version"])
         count = 0
         cap_refresh = 10
-- 
2.20.1




More information about the Patchew-devel mailing list