guydav commited on
Commit
a309dab
1 Parent(s): 42e1223

Catching an error better

Browse files
Files changed (1) hide show
  1. restrictedpython_code_eval.py +7 -4
restrictedpython_code_eval.py CHANGED
@@ -245,10 +245,13 @@ def _check_correctness(check_program, timeout, task_id, completion_id,
245
  additional_globals, additional_locals, allowed_imports
246
  )
247
  p = multiprocessing.Process(target=_unsafe_execute, args=args)
248
- p.start()
249
- p.join(timeout=timeout + 1)
250
- if p.is_alive():
251
- p.kill()
 
 
 
252
 
253
  if not result:
254
  result.append("timed out")
 
245
  additional_globals, additional_locals, allowed_imports
246
  )
247
  p = multiprocessing.Process(target=_unsafe_execute, args=args)
248
+ try:
249
+ p.start()
250
+ p.join(timeout=timeout + 1)
251
+ if p.is_alive():
252
+ p.kill()
253
+ except EOFError as e:
254
+ result.append(f"EOFError: {e}")
255
 
256
  if not result:
257
  result.append("timed out")