mirror of
https://github.com/ankitects/anki.git
synced 2025-11-09 14:17:13 -05:00
fix pid detection on windows
This commit is contained in:
parent
da0d5fb0d4
commit
8d60bcaf05
1 changed files with 11 additions and 5 deletions
|
|
@ -97,11 +97,17 @@ documentation for information on using a flash drive.""")
|
||||||
if os.path.exists(p):
|
if os.path.exists(p):
|
||||||
pid = int(open(p).read())
|
pid = int(open(p).read())
|
||||||
exists = False
|
exists = False
|
||||||
try:
|
if isWin:
|
||||||
os.kill(pid, 0)
|
# no posix on windows, sigh
|
||||||
exists = True
|
from win32process import EnumProcesses as enum
|
||||||
except OSError:
|
if pid in enum():
|
||||||
pass
|
exists = True
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
os.kill(pid, 0)
|
||||||
|
exists = True
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
if exists:
|
if exists:
|
||||||
QMessageBox.warning(
|
QMessageBox.warning(
|
||||||
None, "Error", _("""\
|
None, "Error", _("""\
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue