If I launch several of subprocesses in python (using Popen, for instance), how can I place the main thread into sleep mode until at least of them finished? I also need to put some timeout, if none of them finishes after 1min I want to record some log.
If I use p[i].wait(timeout)
doesn't work because it will block until p[i] finish, hence if any other subprocess finishes (p[j] - for j!=i
) my main thread wouldn't be notified.
What is the proper way to accomplish this?