Build the command-line arguments for launching the internal Camoufox process. This is a pure function (no I/O) that can be easily unit tested. Args: final_launch_mode: The launch mode (headless, virtual_headless, debug) effective_active_auth_json_path: Path to auth fil
(
final_launch_mode: str,
effective_active_auth_json_path: Optional[str],
simulated_os_for_camoufox: str,
camoufox_debug_port: int,
internal_camoufox_proxy: Optional[str],
)
| 51 | |
| 52 | |
| 53 | def build_launch_command( |
| 54 | final_launch_mode: str, |
| 55 | effective_active_auth_json_path: Optional[str], |
| 56 | simulated_os_for_camoufox: str, |
| 57 | camoufox_debug_port: int, |
| 58 | internal_camoufox_proxy: Optional[str], |
| 59 | ) -> list[str]: |
| 60 | """ |
| 61 | Build the command-line arguments for launching the internal Camoufox process. |
| 62 | |
| 63 | This is a pure function (no I/O) that can be easily unit tested. |
| 64 | |
| 65 | Args: |
| 66 | final_launch_mode: The launch mode (headless, virtual_headless, debug) |
| 67 | effective_active_auth_json_path: Path to auth file, or None |
| 68 | simulated_os_for_camoufox: OS to simulate (linux, windows, macos) |
| 69 | camoufox_debug_port: Debug port for Camoufox |
| 70 | internal_camoufox_proxy: Proxy configuration, or None |
| 71 | |
| 72 | Returns: |
| 73 | List of command-line arguments for subprocess.Popen |
| 74 | """ |
| 75 | cmd = [ |
| 76 | PYTHON_EXECUTABLE, |
| 77 | "-u", |
| 78 | sys.argv[0], |
| 79 | "--internal-launch-mode", |
| 80 | final_launch_mode, |
| 81 | ] |
| 82 | |
| 83 | if effective_active_auth_json_path: |
| 84 | cmd.extend(["--internal-auth-file", effective_active_auth_json_path]) |
| 85 | |
| 86 | cmd.extend(["--internal-camoufox-os", simulated_os_for_camoufox]) |
| 87 | cmd.extend(["--internal-camoufox-port", str(camoufox_debug_port)]) |
| 88 | |
| 89 | if internal_camoufox_proxy is not None: |
| 90 | cmd.extend(["--internal-camoufox-proxy", internal_camoufox_proxy]) |
| 91 | |
| 92 | return cmd |
| 93 | |
| 94 | |
| 95 | class CamoufoxProcessManager: |
no outgoing calls