added auto port find

This commit is contained in:
William Falcon 2019-07-24 14:57:09 -04:00
parent 9a3f373d16
commit 46886f0c3c
1 changed files with 5 additions and 7 deletions

View File

@ -128,12 +128,14 @@ def mainasdf():
clear_save_dir()
def get_pids(port):
if __name__ == '__main__':
import subprocess
import re
print('getting pid')
command = "sudo lsof -i :%s | awk '{print $2}'" % port
command = "sudo lsof -i :%s | awk '{print $2}'" % 12910
pids = subprocess.check_output(command, shell=True)
pids = pids.strip()
print(pids)
@ -143,8 +145,4 @@ def get_pids(port):
try:
yield int(pid)
except:
pass
if __name__ == '__main__':
get_pids(12910)
pass