Spaces:
Runtime error
Runtime error
Terry Zhuo commited on
Commit ·
5ba27b9
1
Parent(s): 91c93fa
rm timer
Browse files78 unmodified lines79808182838485868788899091929394959697989978 unmodified linesprocess = subprocess.Popen(command.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)def kill_process():if process.poll() is None: # If the process is still runningprocess.terminate()yield "Process terminated after 6 minutes timeout.\n"# Start a timer to kill the process after 6 minutestimer = threading.Timer(360, kill_process)timer.start()for line in process.stdout:yield lineprocess.wait()timer.cancel()if process.returncode != 0:yield f"Error: Command exited with status {process.returncode}\n"78 unmodified lines79808182838485868788899091929394959697989978 unmodified linesprocess = subprocess.Popen(command.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)# def kill_process():# if process.poll() is None: # If the process is still running# process.terminate()# yield "Process terminated after 6 minutes timeout.\n"# # Start a timer to kill the process after 6 minutes# timer = threading.Timer(360, kill_process)# timer.start()for line in process.stdout:yield lineprocess.wait()# timer.cancel()if process.returncode != 0:yield f"Error: Command exited with status {process.returncode}\n"
app.py+8-8