mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
add wait kwarg to call()
This commit is contained in:
parent
af176921df
commit
df3185ab0f
1 changed files with 9 additions and 8 deletions
|
@ -57,19 +57,20 @@ def stripLatex(text):
|
||||||
text = text.replace(match.group(), "")
|
text = text.replace(match.group(), "")
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def call(*args, **kwargs):
|
def call(*args, wait=True, **kwargs):
|
||||||
try:
|
try:
|
||||||
o = subprocess.Popen(*args, **kwargs)
|
o = subprocess.Popen(*args, **kwargs)
|
||||||
except OSError:
|
except OSError:
|
||||||
# command not found
|
# command not found
|
||||||
return -1
|
return -1
|
||||||
while 1:
|
if wait:
|
||||||
try:
|
while 1:
|
||||||
ret = o.wait()
|
try:
|
||||||
except OSError:
|
ret = o.wait()
|
||||||
# interrupted system call
|
except OSError:
|
||||||
continue
|
# interrupted system call
|
||||||
break
|
continue
|
||||||
|
break
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def latexImgFile(deck, latexCode):
|
def latexImgFile(deck, latexCode):
|
||||||
|
|
Loading…
Reference in a new issue