From 546270a5606893b6232632f2cfee054bd2ed2d7b Mon Sep 17 00:00:00 2001 From: Papoteur Date: Tue, 3 Nov 2020 08:28:18 +0100 Subject: Avoid race conditions to detect other instance --- lib/isodumper.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') 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() -- cgit v1.2.1