systemprompt-cli 0.1.18

systemprompt.io OS - CLI for agent orchestration, AI operations, and system management
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use anyhow::{Context, Result, anyhow};
use std::path::PathBuf;
use std::process::Command;

pub fn run_command_in_dir(command: &str, args: &[&str], directory: &PathBuf) -> Result<()> {
    let status = Command::new(command)
        .args(args)
        .current_dir(directory)
        .status()
        .with_context(|| format!("Failed to run: {} {}", command, args.join(" ")))?;

    if !status.success() {
        return Err(anyhow!("Command failed: {} {}", command, args.join(" ")));
    }

    Ok(())
}