summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@gmail.com>2021-01-01 19:23:48 -0800
committerIrene Knapp <ireneista@gmail.com>2021-01-01 19:23:48 -0800
commitc7ecc405b08e73ad0a9ac809b149f59adc6d1ac2 (patch)
tree9785c319e982f2f885b497d1c6d8a492dd87f38e /src
parent51350d90092b3099630e2fd98bfb0935cf7b0945 (diff)
actually run the commandgit add src/main.rs ! even pass it some arguments! also, print a newline at the start of the prompt
Diffstat (limited to 'src')
-rw-r--r--src/main.rs10
1 files changed, 8 insertions, 2 deletions
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);