Spaces:
Sleeping
Sleeping
File size: 702 Bytes
30b1610 |
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 28 29 30 31 |
"""
Evaluates a generated Clojure program (.clj).
"""
import os
from pathlib import Path
from safe_subprocess import run
from libeval import run_without_exn
def eval_script(path: Path):
result = run(["clojure", "-J-Dclojure.main.report=stderr", "-M", str(path)])
if result.timeout:
status = "Timeout"
elif result.exit_code != 0:
status = "Exception"
elif "\n0 failures, 0 errors.\n" in result.stdout:
status = "OK"
else: # test failure
status = "Exception"
return {
"status": status,
"exit_code": result.exit_code,
"stdout": result.stdout,
"stderr": result.stderr,
}
if __name__ == "__main__":
main()
|