mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
微調
This commit is contained in:
parent
8a7363e77d
commit
60d16926eb
@ -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
|
||||
|
@ -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')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user