fix pid detection on windows

This commit is contained in:
Damien Elmes 2012-05-14 04:59:21 +09:00
parent da0d5fb0d4
commit 8d60bcaf05

View file

@ -97,11 +97,17 @@ documentation for information on using a flash drive.""")
if os.path.exists(p):
pid = int(open(p).read())
exists = False
try:
os.kill(pid, 0)
exists = True
except OSError:
pass
if isWin:
# no posix on windows, sigh
from win32process import EnumProcesses as enum
if pid in enum():
exists = True
else:
try:
os.kill(pid, 0)
exists = True
except OSError:
pass
if exists:
QMessageBox.warning(
None, "Error", _("""\