assemble 0.1.2

assemble following a set of defined instructions in a YAML file
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::collections::BTreeMap;
use std::error::Error;
use std::process::{Child, Command};

/// # Errors
///
/// Will return `Err` if can't execute the command
/// permission to read it.
pub fn run(cmd: &str, env: &BTreeMap<String, String>) -> Result<Child, Box<dyn Error>> {
    if env.is_empty() {
        Ok(Command::new("sh").arg("-c").arg(cmd).spawn()?)
    } else {
        Ok(Command::new("sh").arg("-c").arg(cmd).envs(env).spawn()?)
    }
}