fix timeout

This commit is contained in:
~d6 2024-01-23 11:07:09 -05:00
parent 1bdc4ec719
commit 589fbebf3e
1 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
from os import system
from subprocess import run
from subprocess import run, TimeoutExpired
from sys import stdin, stdout
from tempfile import mkstemp
@ -55,13 +55,13 @@ def execute(s, sandbox=None, timeout=2.0):
try:
res = run(['uxnasm', tmp_tal, tmp_rom], cwd=sandbox, capture_output=True, timeout=timeout)
except TimeoutExpired:
return 'uxnasm: timed out'
return b'uxnasm: timed out'
if res.returncode != 0:
return res.stderr
try:
res = run(['uxncli', tmp_rom], cwd=sandbox, capture_output=True, timeout=timeout)
except TimeoutExpired:
return 'uxncli: timed out'
return b'uxncli: timed out'
return res.stdout
def main():