Spaces:
Runtime error
Runtime error
Terry Zhuo commited on
Commit ·
91c93fa
1
Parent(s): 0821709
addtimer
Browse files78 unmodified lines7980818283848586878878 unmodified linesprocess = subprocess.Popen(command.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)for line in process.stdout:yield line# process.wait()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 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"
app.py+12-1