MCPcopy Create free account
hub / github.com/consensus-shipyard/ipc / init_comet_binary

Function init_comet_binary

ipc/cli/src/comet_runner/binary.rs:11–42  ·  view source on GitHub ↗

Initialize the CometBFT binary

()

Source from the content-addressed store, hash-verified

9
10/// Initialize the CometBFT binary
11pub fn init_comet_binary() -> Result<PathBuf> {
12 let file_name = if cfg!(windows) {
13 "cometbft.exe"
14 } else {
15 "cometbft"
16 };
17 let binary_path = env::temp_dir().join(file_name);
18
19 // Skip if already exists
20 if binary_path.exists() {
21 return Ok(binary_path);
22 }
23
24 // Write the binary
25 fs::write(&binary_path, COMET_BIN).with_context(|| {
26 format!(
27 "failed to write CometBFT binary to {}",
28 binary_path.display()
29 )
30 })?;
31
32 // Make executable on Unix
33 #[cfg(unix)]
34 {
35 use std::os::unix::fs::PermissionsExt;
36 let mut perms = fs::metadata(&binary_path)?.permissions();
37 perms.set_mode(0o755);
38 fs::set_permissions(&binary_path, perms)?;
39 }
40
41 Ok(binary_path)
42}

Callers 3

get_cometbft_node_idFunction · 0.85
run_with_restartMethod · 0.85
run_cometFunction · 0.85

Calls 4

writeFunction · 0.85
existsMethod · 0.80
with_contextMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected