use std::process::Command; use std::io; pub fn get_log(unit: &str, lines: i32) -> io::Result { let status = try!(Command::new("journalctl") .args(&["-u", unit, "-n", &lines.to_string()]) .output()); Ok(String::from_utf8_lossy(&status.stdout).into_owned()) }