Spaces:
BG5
/
Running

BG5 commited on
Commit
c170e9c
·
verified ·
1 Parent(s): 9ec7423

Update fun.py

Browse files
Files changed (1) hide show
  1. fun.py +13 -13
fun.py CHANGED
@@ -73,19 +73,19 @@ async def open_browser(request: Request):
73
  # 加入默认参数
74
  logger.info(f"使用默认参数: {get_default_launch_args()}")
75
  args.extend(get_default_launch_args())
76
- if launch_args:
77
- # 拆分参数并去重,保留顺序
78
- base_args = args[1:] # 除去chrome可执行文件
79
- extra_args = [a for a in launch_args.split() if a]
80
- all_args = base_args + extra_args
81
- seen = set()
82
- deduped_args = []
83
- for arg in all_args:
84
- key = arg.split('=')[0].strip() if '=' in arg else arg.strip()
85
- if key not in seen:
86
- seen.add(key)
87
- deduped_args.append(arg)
88
- args = [CHROME_PATH] + deduped_args
89
  proc = subprocess.Popen(args, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
90
  if not wait_port("127.0.0.1", port, timeout=60):
91
  proc.terminate()
 
73
  # 加入默认参数
74
  logger.info(f"使用默认参数: {get_default_launch_args()}")
75
  args.extend(get_default_launch_args())
76
+ # if launch_args:
77
+ # # 拆分参数并去重,保留顺序
78
+ # base_args = args[1:] # 除去chrome可执行文件
79
+ # extra_args = [a for a in launch_args.split() if a]
80
+ # all_args = base_args + extra_args
81
+ # seen = set()
82
+ # deduped_args = []
83
+ # for arg in all_args:
84
+ # key = arg.split('=')[0].strip() if '=' in arg else arg.strip()
85
+ # if key not in seen:
86
+ # seen.add(key)
87
+ # deduped_args.append(arg)
88
+ # args = [CHROME_PATH] + deduped_args
89
  proc = subprocess.Popen(args, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
90
  if not wait_port("127.0.0.1", port, timeout=60):
91
  proc.terminate()