MCPcopy Create free account
hub / github.com/microsoft/Webwright / _cmd_release

Function _cmd_release

src/webwright/tools/persistent_local_browser.py:203–228  ·  view source on GitHub ↗
(args: argparse.Namespace)

Source from the content-addressed store, hash-verified

201
202
203def _cmd_release(args: argparse.Namespace) -> int:
204 session_path = _resolve_path(args.session_file, args.workspace_dir)
205 if not session_path.exists():
206 print(f"LB_RELEASE_SKIPPED missing={session_path}")
207 return 0
208 session = json.loads(session_path.read_text(encoding="utf-8"))
209 pid = int(session.get("pid", 0))
210 status = _terminate_pid(pid, args.kill_timeout)
211 print(f"LB_RELEASE_REQUESTED pid={pid} status={status}")
212
213 if args.delete_user_data:
214 udd = session.get("userDataDir", "")
215 if udd and Path(udd).exists():
216 try:
217 shutil.rmtree(udd)
218 print(f"LB_USER_DATA_DELETED {udd}")
219 except OSError as exc:
220 print(f"LB_USER_DATA_DELETE_FAILED {udd} {exc}")
221
222 if args.delete_file:
223 try:
224 session_path.unlink()
225 print(f"LB_SESSION_FILE_DELETED {session_path}")
226 except OSError as exc:
227 print(f"LB_SESSION_FILE_DELETE_FAILED {session_path} {exc}")
228 return 0
229
230
231def _build_parser() -> argparse.ArgumentParser:

Callers

nothing calls this directly

Calls 2

_resolve_pathFunction · 0.85
_terminate_pidFunction · 0.85

Tested by

no test coverage detected