This commit is contained in:
2024-12-04 17:19:46 +01:00
parent af390dd779
commit da8583ab28
36 changed files with 712 additions and 69 deletions

View File

@@ -1,3 +1,4 @@
from pathlib import Path
import subprocess
import xml.etree.ElementTree as ET
from typing import Optional
@@ -15,6 +16,7 @@ class SingleEntry(Entry):
def __init__(
self,
id: str,
work_dir: Path,
script: str,
timeout: Optional[float] = None,
limit: Optional[int] = None,
@@ -29,6 +31,7 @@ class SingleEntry(Entry):
limit: Maximum number of characters to capture from stdout/stderr
"""
super().__init__(id)
self.work_dir = work_dir
self.script = script
self.timeout = timeout
self.limit = limit
@@ -58,6 +61,7 @@ class SingleEntry(Entry):
try:
process = subprocess.run(
self.script,
cwd=self.work_dir,
timeout=(self.timeout or self.default_timeout),
shell=True,
capture_output=True,
@@ -106,6 +110,7 @@ class SingleEntry(Entry):
return {
"type": "single",
"id": self.id,
"work_dir": str(self.work_dir),
"script": self.script,
"timeout": self.timeout,
"limit": self.limit,