Last active
January 1, 2020 05:38
-
-
Save ilius/621daad094983a33826e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import psutil | |
ps_by_pid = dict([(p.pid, p) for p in psutil.get_process_list()]) | |
my_pid = os.getpid() | |
#my_proc = ps_by_pid[my_pid] | |
my_proc = psutil.Process(my_pid) | |
my_cmd = my_proc.cmdline() ## list, for example: ['python3', 'psutil-example.py'] | |
print(my_pid, my_cmd) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment