Launch headless Chromium against a system-installed browser. install.sh provisions it.
()
| 121 | |
| 122 | /// Launch headless Chromium against a system-installed browser. install.sh provisions it. |
| 123 | fn launch() -> Result<Browser> { |
| 124 | let mut builder = LaunchOptions::default_builder(); |
| 125 | builder.sandbox(false); // headless under WSL/containers typically can't sandbox |
| 126 | // Default is 30s and the REPL would drop CDP whenever the user stopped to think. |
| 127 | builder.idle_browser_timeout(Duration::from_secs(60 * 60 * 24)); |
| 128 | builder.path(Some(resolve_chrome()?)); |
| 129 | let options = builder.build().map_err(|e| anyhow!("building launch options: {e}"))?; |
| 130 | Browser::new(options).map_err(|e| anyhow!("{e}")) |
| 131 | } |
| 132 | |
| 133 | /// Prefer env override, then any Chrome on PATH, then a Playwright-cached Chromium. |
| 134 | fn resolve_chrome() -> Result<PathBuf> { |
no test coverage detected