(args: argparse.Namespace)
| 201 | |
| 202 | |
| 203 | def _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 | |
| 231 | def _build_parser() -> argparse.ArgumentParser: |
nothing calls this directly
no test coverage detected