I'm scripting in python
.
I need to write to disk, and run some shell scripts.
However, depending on the the input, these may take a long time, and I want to kill them if they take too long.
I want something like:
def run_once(input_text):
with open("temp.file", "w") as f:
f.write(input_text)
os.system("./synthesize.sh temp.tsl")
for single in many:
if(takes_more_than_60_seconds(run_once(input_text)):
kill(process)
print("Process killed since it took too long. Moving to the next job.")