From c7ecc405b08e73ad0a9ac809b149f59adc6d1ac2 Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Fri, 1 Jan 2021 19:23:48 -0800 Subject: actually run the commandgit add src/main.rs ! even pass it some arguments! also, print a newline at the start of the prompt --- src/main.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index ff6d90e..d1a25a6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,6 +4,7 @@ use std::collections::HashSet; use std::io; use std::io::prelude::*; use std::os::unix::fs::PermissionsExt; +use std::process::Command; #[macro_use] extern crate lalrpop_util; @@ -49,7 +50,7 @@ fn repl() -> Result<()> { fn prompt() -> Result<()> { - print!("$ "); + print!("\n$ "); io::stdout().flush()?; Ok(()) @@ -89,7 +90,12 @@ fn execute(input: &str) -> Result<()> { [command_name, ..] => { match find_executable_path(command_name)? { Some(executable_path) => { - println!("{}", executable_path); + let mut command = Command::new(executable_path.to_sys_path()); + + let arguments = &invocation[1..]; + command.args(arguments); + + let _status = command.status()?; } None => { println!("Command not found: {}", command_name); -- cgit 1.4.1