aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2020-11-03 08:28:18 +0100
committerPapoteur <papoteur@mageia.org>2020-11-03 08:29:18 +0100
commit546270a5606893b6232632f2cfee054bd2ed2d7b (patch)
treea45f7678de58fd4f6d164911df648e819ac0e42b /lib
parent7dbf5bac6a0790022915d6065fbbe511f4f7367f (diff)
downloadisodumper-546270a5606893b6232632f2cfee054bd2ed2d7b.tar
isodumper-546270a5606893b6232632f2cfee054bd2ed2d7b.tar.gz
isodumper-546270a5606893b6232632f2cfee054bd2ed2d7b.tar.bz2
isodumper-546270a5606893b6232632f2cfee054bd2ed2d7b.tar.xz
isodumper-546270a5606893b6232632f2cfee054bd2ed2d7b.zip
Avoid race conditions to detect other instance
Diffstat (limited to 'lib')
-rwxr-xr-xlib/isodumper.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/isodumper.py b/lib/isodumper.py
index 9b67c2f..69a645a 100755
--- a/lib/isodumper.py
+++ b/lib/isodumper.py
@@ -561,9 +561,9 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog
# Check that there is no other instance running
current_pid = psutil.Process().pid
- for pid in psutil.pids():
- p = psutil.Process(pid)
- if p.name() == "isodumper" and p.pid != current_pid:
+ proc_iter = psutil.process_iter(attrs=["pid", "name"])
+ for p in proc_iter:
+ if p.info["name"] == APP and p.info["name"] != current_pid:
info = Info(_("Error"), True, _("There is another instance of Isodumper already running."))
self.ask_OK(info)
yui.YUILoader.deleteUI()