Created
April 12, 2021 15:07
-
-
Save josephdunn/fe87d8c65cd8d3c3e270c0bc711f3f6b 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
#!/usr/bin/env python | |
# Duplicates an already-running process. Argument should be PID of running process. | |
import sys | |
import subprocess | |
import psutil | |
try: | |
p = psutil.Process(int(sys.argv[1])) | |
except psutil.NoSuchProcess: | |
print('could not find process with PID %s' % sys.argv[1]) | |
else: | |
subprocess.run(p.cmdline()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment