MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / run_acp_bridge_candidate

Function run_acp_bridge_candidate

crates/opencode-cli/src/main.rs:2138–2171  ·  view source on GitHub ↗
(
    program: &str,
    args: &[String],
    cwd: Option<&Path>,
)

Source from the content-addressed store, hash-verified

2136}
2137
2138fn run_acp_bridge_candidate(
2139 program: &str,
2140 args: &[String],
2141 cwd: Option<&Path>,
2142) -> anyhow::Result<bool> {
2143 let mut cmd = ProcessCommand::new(program);
2144 cmd.args(args)
2145 .stdin(Stdio::inherit())
2146 .stdout(Stdio::inherit())
2147 .stderr(Stdio::inherit())
2148 .env("OPENCODE_ACP_BRIDGE_ACTIVE", "1");
2149
2150 if let Some(dir) = cwd {
2151 cmd.current_dir(dir);
2152 }
2153
2154 let status = match cmd.status() {
2155 Ok(status) => status,
2156 Err(err) if err.kind() == io::ErrorKind::NotFound => return Ok(false),
2157 Err(err) => {
2158 anyhow::bail!("Failed to launch ACP bridge command `{}`: {}", program, err);
2159 }
2160 };
2161
2162 if !status.success() {
2163 anyhow::bail!(
2164 "ACP bridge command `{}` exited with status {}",
2165 program,
2166 status
2167 );
2168 }
2169
2170 Ok(true)
2171}
2172
2173fn try_run_external_acp_bridge(
2174 port: u16,

Callers 1

Calls 3

newFunction · 0.85
statusMethod · 0.45
successMethod · 0.45

Tested by

no test coverage detected