MCPcopy Create free account
hub / github.com/clawshell/clawshell / start_clawshell_direct

Function start_clawshell_direct

src/main.rs:2136–2162  ·  view source on GitHub ↗

Start ClawShell directly by spawning a child process (no service manager).

(
    toml_config_path: &std::path::Path,
)

Source from the content-addressed store, hash-verified

2134
2135/// Start ClawShell directly by spawning a child process (no service manager).
2136fn start_clawshell_direct(
2137 toml_config_path: &std::path::Path,
2138) -> Result<(), Box<dyn std::error::Error>> {
2139 let exe = std::env::current_exe()?;
2140 let log_path = process::log_file_path();
2141 let log_file = std::fs::OpenOptions::new()
2142 .create(true)
2143 .append(true)
2144 .open(&log_path)?;
2145 let log_stderr = log_file.try_clone()?;
2146
2147 let child = std::process::Command::new(exe)
2148 .args([
2149 "start",
2150 "--config",
2151 &toml_config_path.to_string_lossy(),
2152 "--foreground",
2153 ])
2154 .stdout(log_file)
2155 .stderr(log_stderr)
2156 .stdin(std::process::Stdio::null())
2157 .spawn()?;
2158
2159 let pid = child.id();
2160 tui::print_info("Process ID", &pid.to_string());
2161 Ok(())
2162}

Callers 1

cmd_onboardFunction · 0.85

Calls 3

print_infoFunction · 0.85
log_file_pathFunction · 0.70
idMethod · 0.45

Tested by

no test coverage detected