@@ -17,29 +17,29 @@ def __init__(self, sio2jail_path):
1717
1818 def _wrap_command (self , command : List [str ], result_file_path : str , time_limit : int , memory_limit : int ) -> List [str ]:
1919 # see: https://github.com/sio2project/sioworkers/blob/738aa7a4e93216b0900ca128d6d48d40cd38bc1e/sio/workers/executors.py#L608
20- return [f'"{ self .sio2jail_path } "' , '--mount-namespace' , 'off' , '--pid-namespace' , 'off' , '--uts-namespace' ,
20+ return [f'"{ self .sio2jail_path } "' , '-f' , '3' , '- -mount-namespace' , 'off' , '--pid-namespace' , 'off' , '--uts-namespace' ,
2121 'off' , '--ipc-namespace' , 'off' , '--net-namespace' , 'off' , '--capability-drop' , 'off' ,
2222 '--user-namespace' , 'off' , '--instruction-count-limit' , f'{ int (2 * time_limit )} M' ,
2323 '--rtimelimit' , f'{ int (16 * time_limit + 1000 )} ms' , '--memory-limit' , f'{ int (memory_limit )} K' ,
24- '--output-limit' , '51200K' , '--output' , 'oiaug' , '--stderr' , '--' ] + command
24+ '--output-limit' , '51200K' , '--output' , 'oiaug' , '--stderr' , '--' ] + command + \
25+ ['3>' , f'"{ result_file_path } "' ]
2526
2627 def _execute (self , cmdline : str , time_limit : int , hard_time_limit : int , memory_limit : int ,
2728 result_file_path : str , executable : str , execution_dir : str , stdin : int , stdout : int ,
2829 stderr : Union [None , int ], fds_to_close : Union [None , List [int ]],
2930 * args , ** kwargs ) -> Tuple [bool , bool , int , List [str ]]:
3031 env = os .environ .copy ()
3132 env ['UNDER_SIO2JAIL' ] = "1"
32- with open (result_file_path , "w" ) as result_file :
33- try :
34- process = subprocess .Popen (cmdline , * args , shell = True , stdin = stdin , stdout = stdout , env = env ,
35- stderr = result_file , preexec_fn = os .setpgrp , cwd = execution_dir , ** kwargs )
36- except TypeError as e :
37- print (util .error (f"Invalid command: `{ cmdline } `" ))
38- raise e
39- if fds_to_close is not None :
40- for fd in fds_to_close :
41- os .close (fd )
42- process .wait ()
33+ try :
34+ process = subprocess .Popen (cmdline , * args , shell = True , stdin = stdin , stdout = stdout , env = env ,
35+ stderr = subprocess .DEVNULL , preexec_fn = os .setpgrp , cwd = execution_dir , ** kwargs )
36+ except TypeError as e :
37+ print (util .error (f"Invalid command: `{ cmdline } `" ))
38+ raise e
39+ if fds_to_close is not None :
40+ for fd in fds_to_close :
41+ os .close (fd )
42+ process .wait ()
4343
4444 return False , False , 0 , []
4545
0 commit comments