Spaces:
Running
Running
File size: 640 Bytes
41e79e2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
from pathlib import Path
from src.safe_subprocess import run
def eval_script(path: Path):
r = run(["luau-analyze", str(path)])
if r.timeout:
status = "Timeout"
elif r.exit_code == 0:
r = run(["luau", str(path)])
if r.timeout:
status = "Timeout"
elif r.exit_code == 0:
status = "OK"
else:
status = "Exception"
elif "SyntaxError" in r.stderr:
status = "SyntaxError"
else:
status = "TypeError"
return {
"status": status,
"exit_code": r.exit_code,
"stdout": r.stdout,
"stderr": r.stderr,
}
|