Currently I am using the python os.system(cmd) to do some daily works.
Here is one situation, the cmd will take 5-6 minutes to finish, and I run this cmd maually, it works, but when I put it into os.system(cmd), os.system(cmd) will automatically exit when the cmd is not finished yet.
So my question is: how to handle this issue, set timeout value or there is any better way to finish this job ?
Thanks in advance!
Have you tried the
subprocessmodule? It was added to replaceos.systemamong other olderosmethods. The following is pretty much straight from the docs:or if you’re trying to debug why the process is exiting: