diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..79262b3 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "jshell" +version = "0.1.0" diff --git a/src/main.rs b/src/main.rs index e7a11a9..d4ce347 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,13 @@ -fn main() { - println!("Hello, world!"); +use std::{io::stdin, process::Command}; + +fn main(){ + let mut input = String::new(); + stdin().read_line(&mut input).unwrap(); + + // read_line leaves a trailing newline, which trim removes + let command = input.trim(); + + Command::new(command) + .spawn() + .unwrap(); }