Cross-platform way to get PIDs by process name in python

后端 未结 8 1081
后悔当初
后悔当初 2020-12-02 09:35

Several processes with the same name are running on host. What is the cross-platform way to get PIDs of those processes by name using python or jyth

8条回答
  •  天命终不由人
    2020-12-02 10:25

    For jython, if Java 5 is used, then you can get the Java process id as following:

    from java.lang.management import *
    pid = ManagementFactory.getRuntimeMXBean().getName()

提交回复
热议问题