himalaya 0.5.4

Command-line interface for email management
1
2
3
4
5
6
7
8
9
10
11
12
13
use anyhow::Result;
use std::process::Command;

/// TODO: move this in a more approriate place.
pub fn run_cmd(cmd: &str) -> Result<String> {
    let output = if cfg!(target_os = "windows") {
        Command::new("cmd").args(&["/C", cmd]).output()
    } else {
        Command::new("sh").arg("-c").arg(cmd).output()
    }?;

    Ok(String::from_utf8(output.stdout)?)
}