feat: implement command execution from user input
All checks were successful
Release / Release (push) Successful in 37s

This commit is contained in:
Jan Gleytenhoover 2024-08-28 07:54:05 +02:00
parent 1af0dd819d
commit dab3905078
Signed by: jank
GPG Key ID: B267751B8AE29EFE
2 changed files with 19 additions and 2 deletions

7
Cargo.lock generated Normal file

@ -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"

@ -1,3 +1,13 @@
use std::{io::stdin, process::Command};
fn main(){
println!("Hello, world!");
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();
}