sal/src/virt/nerdctl/cmd.rs
Mahmoud-Emad 5194f5245d chore: Update Gitea host and Zinit client dependency
- Updated the Gitea host URL in `.roo/mcp.json` and `Cargo.toml`
  to reflect the change from `git.ourworld.tf` to `git.threefold.info`.
- Updated the `zinit-client` dependency in `Cargo.toml` to version
  `0.3.0`.  This ensures compatibility with the updated repository.
- Updated file paths in example files to reflect the new repository URL.
2025-06-15 20:36:02 +03:00

37 lines
1.2 KiB
Rust

// File: /root/code/git.threefold.info/herocode/sal/src/virt/nerdctl/cmd.rs
// Basic nerdctl operations for container management
use std::process::Command;
use crate::process::CommandResult;
use super::NerdctlError;
/// Execute a nerdctl command and return the result
pub fn execute_nerdctl_command(args: &[&str]) -> Result<CommandResult, NerdctlError> {
let output = Command::new("nerdctl")
.args(args)
.output();
match output {
Ok(output) => {
let stdout = String::from_utf8_lossy(&output.stdout).to_string();
let stderr = String::from_utf8_lossy(&output.stderr).to_string();
let result = CommandResult {
stdout,
stderr,
success: output.status.success(),
code: output.status.code().unwrap_or(-1),
};
if result.success {
Ok(result)
} else {
Err(NerdctlError::CommandFailed(format!("Command failed with code {}: {}",
result.code, result.stderr.trim())))
}
},
Err(e) => {
Err(NerdctlError::CommandExecutionFailed(e))
}
}
}