Clean up zombie processes and timeout at 5
This commit is contained in:
		
							parent
							
								
									d0f3f0ba31
								
							
						
					
					
						commit
						8b42e0ec09
					
				
							
								
								
									
										10
									
								
								runall.py
								
								
								
								
							
							
						
						
									
										10
									
								
								runall.py
								
								
								
								
							|  | @ -6,7 +6,15 @@ chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'( | |||
| 
 | ||||
| def check_pair(script, instr, outstr): | ||||
|     result = subprocess.run( | ||||
|         ["/usr/bin/env", "bash", "-c", script], | ||||
|         [ | ||||
|             "/usr/bin/env", "bash", "-c", | ||||
|             ";\n".join(( | ||||
|                 # Cleanup child processes on exit | ||||
|                 "trap 'kill -9 $(jobs -p)' SIGINT SIGTERM EXIT", | ||||
|                 script, | ||||
|             )) | ||||
|         ], | ||||
|         timeout=5, | ||||
|         input=instr.encode(), | ||||
|         capture_output=True, | ||||
|     ) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue