fix timeout
This commit is contained in:
parent
1bdc4ec719
commit
589fbebf3e
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
from os import system
|
from os import system
|
||||||
from subprocess import run
|
from subprocess import run, TimeoutExpired
|
||||||
from sys import stdin, stdout
|
from sys import stdin, stdout
|
||||||
from tempfile import mkstemp
|
from tempfile import mkstemp
|
||||||
|
|
||||||
|
@ -55,13 +55,13 @@ def execute(s, sandbox=None, timeout=2.0):
|
||||||
try:
|
try:
|
||||||
res = run(['uxnasm', tmp_tal, tmp_rom], cwd=sandbox, capture_output=True, timeout=timeout)
|
res = run(['uxnasm', tmp_tal, tmp_rom], cwd=sandbox, capture_output=True, timeout=timeout)
|
||||||
except TimeoutExpired:
|
except TimeoutExpired:
|
||||||
return 'uxnasm: timed out'
|
return b'uxnasm: timed out'
|
||||||
if res.returncode != 0:
|
if res.returncode != 0:
|
||||||
return res.stderr
|
return res.stderr
|
||||||
try:
|
try:
|
||||||
res = run(['uxncli', tmp_rom], cwd=sandbox, capture_output=True, timeout=timeout)
|
res = run(['uxncli', tmp_rom], cwd=sandbox, capture_output=True, timeout=timeout)
|
||||||
except TimeoutExpired:
|
except TimeoutExpired:
|
||||||
return 'uxncli: timed out'
|
return b'uxncli: timed out'
|
||||||
return res.stdout
|
return res.stdout
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
Loading…
Reference in New Issue