Spaces:
Runtime error
Runtime error
fix: rust timeout exception
#1
by
bomjin
- opened
- execute.py +9 -6
execute.py
CHANGED
@@ -241,12 +241,15 @@ def unsafe_execute_rust(check_program, result, timeout, cargo_string):
|
|
241 |
|
242 |
compilation_result = subprocess.run(["cargo", "check", "--bin", "test", "--message-format", "json"], timeout=timeout, capture_output=True)
|
243 |
if compilation_result.returncode == 0:
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
|
|
|
|
|
|
250 |
else:
|
251 |
err = compilation_result.stderr.decode() if compilation_result.stderr else compilation_result.stdout.decode()
|
252 |
result.append("failed: compilation error: " + err)
|
|
|
241 |
|
242 |
compilation_result = subprocess.run(["cargo", "check", "--bin", "test", "--message-format", "json"], timeout=timeout, capture_output=True)
|
243 |
if compilation_result.returncode == 0:
|
244 |
+
try:
|
245 |
+
exec_result = subprocess.run(["cargo", "test", "--bin", "test", "--message-format", "json"], timeout=timeout, capture_output=True)
|
246 |
+
if exec_result.returncode == 0:
|
247 |
+
result.append("passed")
|
248 |
+
else:
|
249 |
+
err = compilation_result.stderr.decode() if compilation_result.stderr else compilation_result.stdout.decode()
|
250 |
+
result.append("failed: execution error: " + err)
|
251 |
+
except subprocess.TimeoutExpired as e:
|
252 |
+
result.append("timed out")
|
253 |
else:
|
254 |
err = compilation_result.stderr.decode() if compilation_result.stderr else compilation_result.stdout.decode()
|
255 |
result.append("failed: compilation error: " + err)
|