This commit is contained in:
g1879 2021-08-15 22:14:28 +08:00
parent 8a7363e77d
commit 60d16926eb
2 changed files with 3 additions and 3 deletions

View File

@ -268,7 +268,7 @@ def get_exe_path_from_port(port: Union[str, int]) -> Union[str, None]:
while not process and perf_counter() - t < 10:
process = popen(f'netstat -ano |findstr {port}').read().split('\n')[0]
processid = process[process.rfind(' ') + 1:]
processid = process.split(' ')[-1]
if not processid:
return

View File

@ -98,7 +98,7 @@ class Drission(object):
# -----------若指定debug端口且该端口未在使用中则先启动浏览器进程-----------
if options.debugger_address and _check_port(options.debugger_address) is False:
from subprocess import Popen
port = options.debugger_address[options.debugger_address.rfind(':') + 1:]
port = options.debugger_address.split(':')[-1]
# 启动浏览器进程,同时返回该进程使用的 chrome.exe 路径
chrome_path, self._debugger = _create_chrome(chrome_path, port,
@ -196,7 +196,7 @@ class Drission(object):
if not txt:
return
pid = txt[txt.rfind(' ') + 1:]
pid = txt.split(' ')[-1]
if popen(f'tasklist | findstr {pid}').read().lower().startswith('chrome.exe'):
popen(f'taskkill /pid {pid} /F')