use mapped_command::{Command, CommandExecutionWithStringOutputError as Error, MapStdoutString}; fn ls_command() -> Command, Error> { Command::new( "ls", MapStdoutString(|out| { let lines = out.lines().map(Into::into).collect::>(); Ok(lines) }), ) } fn main() { let entries = ls_command().run().unwrap(); println!("ls:"); for entry in entries { println!("\t{}", entry); } }