@@ -17,29 +17,29 @@ def __init__(self, sio2jail_path):
17
17
18
18
def _wrap_command (self , command : List [str ], result_file_path : str , time_limit : int , memory_limit : int ) -> List [str ]:
19
19
# 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' ,
21
21
'off' , '--ipc-namespace' , 'off' , '--net-namespace' , 'off' , '--capability-drop' , 'off' ,
22
22
'--user-namespace' , 'off' , '--instruction-count-limit' , f'{ int (2 * time_limit )} M' ,
23
23
'--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 } "' ]
25
26
26
27
def _execute (self , cmdline : str , time_limit : int , hard_time_limit : int , memory_limit : int ,
27
28
result_file_path : str , executable : str , execution_dir : str , stdin : int , stdout : int ,
28
29
stderr : Union [None , int ], fds_to_close : Union [None , List [int ]],
29
30
* args , ** kwargs ) -> Tuple [bool , bool , int , List [str ]]:
30
31
env = os .environ .copy ()
31
32
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 ()
43
43
44
44
return False , False , 0 , []
45
45
0 commit comments