Timeout on subprocess readline in Python
Timeout on subprocess readline in Python Question: I have a small issue that I’m not quite sure how to solve. Here is a minimal example: What I have scan_process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) while(some_criterium): line = scan_process.stdout.readline() some_criterium = do_something(line) What I would like scan_process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) while(some_criterium): line = scan_process.stdout.readline() if nothing_happens_after_10s: …