himalaya/email-manager/src/output/output_utils.rs
Clément DOUIN ad7cd28a3c
init cargo workspace (#252)
* init cargo workspaces

* nix: fix assets path

* doc: update rtp vim plugin

* vim: add error message if loading vim plugin from vim/
2021-10-31 19:30:53 +01:00

14 lines
369 B
Rust

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)?)
}