Spaces:
Sleeping
Sleeping
Muennighoff
commited on
Commit
•
c31f8ea
1
Parent(s):
da88559
Specify err
Browse files- execute.py +7 -6
execute.py
CHANGED
@@ -139,8 +139,7 @@ def unsafe_execute_cpp(check_program, result, timeout):
|
|
139 |
result.append(f"failed: {err}")
|
140 |
|
141 |
except subprocess.TimeoutExpired as e:
|
142 |
-
result.append("timed out")
|
143 |
-
|
144 |
|
145 |
def unsafe_execute_go(check_program, result, timeout):
|
146 |
|
@@ -167,7 +166,6 @@ def unsafe_execute_go(check_program, result, timeout):
|
|
167 |
except subprocess.TimeoutExpired as e:
|
168 |
result.append("timed out")
|
169 |
|
170 |
-
|
171 |
def unsafe_execute_java(check_program, result, timeout):
|
172 |
|
173 |
with create_tempdir():
|
@@ -185,7 +183,8 @@ def unsafe_execute_java(check_program, result, timeout):
|
|
185 |
except subprocess.TimeoutExpired as e:
|
186 |
continue
|
187 |
if compile_returncode != 0:
|
188 |
-
|
|
|
189 |
else:
|
190 |
try:
|
191 |
exec_result = subprocess.run([f'java', '-cp', '.', 'Main'], timeout=timeout, capture_output=True)
|
@@ -261,9 +260,11 @@ def unsafe_execute_rust(check_program, result, timeout, cargo_string):
|
|
261 |
if exec_result.returncode == 0:
|
262 |
result.append("passed")
|
263 |
else:
|
264 |
-
|
|
|
265 |
else:
|
266 |
-
|
|
|
267 |
|
268 |
# Move back to the original working directory
|
269 |
os.chdir(WD)
|
|
|
139 |
result.append(f"failed: {err}")
|
140 |
|
141 |
except subprocess.TimeoutExpired as e:
|
142 |
+
result.append("timed out")
|
|
|
143 |
|
144 |
def unsafe_execute_go(check_program, result, timeout):
|
145 |
|
|
|
166 |
except subprocess.TimeoutExpired as e:
|
167 |
result.append("timed out")
|
168 |
|
|
|
169 |
def unsafe_execute_java(check_program, result, timeout):
|
170 |
|
171 |
with create_tempdir():
|
|
|
183 |
except subprocess.TimeoutExpired as e:
|
184 |
continue
|
185 |
if compile_returncode != 0:
|
186 |
+
err = compilation_result.stderr.decode() if compilation_result.stderr else compilation_result.stdout.decode()
|
187 |
+
res = "failed: compilation error: " + err
|
188 |
else:
|
189 |
try:
|
190 |
exec_result = subprocess.run([f'java', '-cp', '.', 'Main'], timeout=timeout, capture_output=True)
|
|
|
260 |
if exec_result.returncode == 0:
|
261 |
result.append("passed")
|
262 |
else:
|
263 |
+
err = compilation_result.stderr.decode() if compilation_result.stderr else compilation_result.stdout.decode()
|
264 |
+
result.append("failed: execution error: " + err)
|
265 |
else:
|
266 |
+
err = compilation_result.stderr.decode() if compilation_result.stderr else compilation_result.stdout.decode()
|
267 |
+
result.append("failed: compilation error: " + err)
|
268 |
|
269 |
# Move back to the original working directory
|
270 |
os.chdir(WD)
|