I am a newbie in python and trying to get an understanding of psutil
module. My question is that if have more than 1 instance of a process (e.g. two instances of VLC media player), does psutil.kill()
kills all the instances of that process or only one of the instances?
psutil module in python
715 Views Asked by rahuljain1313 At
1
No.
kill
is a method called on a process object, so it is a question of finding the right process. You might iterate through them:The example exception handling is to handle race conditions - the process might finish between finding it and interrogating it. The issue is identifying the correct process you wish to kill. Typically you would use the process ID,
pid
, or maybecmdline
. If you do wish to kill all instances, then useexe
.