(
port: u16,
hostname: String,
mdns: bool,
mdns_domain: String,
cors: Vec<String>,
cwd: PathBuf,
)
| 1929 | } |
| 1930 | |
| 1931 | async fn run_acp_command( |
| 1932 | port: u16, |
| 1933 | hostname: String, |
| 1934 | mdns: bool, |
| 1935 | mdns_domain: String, |
| 1936 | cors: Vec<String>, |
| 1937 | cwd: PathBuf, |
| 1938 | ) -> anyhow::Result<()> { |
| 1939 | std::env::set_current_dir(&cwd) |
| 1940 | .map_err(|e| anyhow::anyhow!("Failed to change directory to {}: {}", cwd.display(), e))?; |
| 1941 | |
| 1942 | if try_run_external_acp_bridge(port, &hostname, mdns, &mdns_domain, &cors, &cwd)? { |
| 1943 | return Ok(()); |
| 1944 | } |
| 1945 | |
| 1946 | eprintln!( |
| 1947 | "Warning: no external ACP stdio bridge runtime found; falling back to HTTP server mode." |
| 1948 | ); |
| 1949 | run_server_command("acp", port, hostname, mdns, mdns_domain, cors).await |
| 1950 | } |
| 1951 | |
| 1952 | fn is_loopback_host(host: &str) -> bool { |
| 1953 | matches!(host, "127.0.0.1" | "localhost" | "::1") |
no test coverage detected