I have a function that checks if a process/app is running, but how do I check when that app closes?
Asked
Active
Viewed 368 times
0
-
If you have an function that checks if it's running (please share if you want people to help), checking if it's closed is simply when that function returns `False`? I assume you mean you want something that executes immediately after or possible even before the application actually closes? Where are you looking to use it? The rest of your program will affect the best solution to use. – Grismar Apr 02 '20 at 01:47
-
If you have a process id on it, you could kill it with `os.kill(pid, 0)`, but if that's what you mean, the question is a duplicate of [how-to-check-if-there-exists-a-process-with-a-given-pid-in-python](https://stackoverflow.com/questions/568271/how-to-check-if-there-exists-a-process-with-a-given-pid-in-python). – metinsenturk Apr 02 '20 at 01:50
-
What OS are you using? – martineau Apr 02 '20 at 02:03