feat: implement command execution from user input
All checks were successful
Release / Release (push) Successful in 37s
All checks were successful
Release / Release (push) Successful in 37s
This commit is contained in:
parent
1af0dd819d
commit
dab3905078
7
Cargo.lock
generated
Normal file
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"
|
12
src/main.rs
12
src/main.rs
@ -1,3 +1,13 @@
|
|||||||
|
use std::{io::stdin, process::Command};
|
||||||
|
|
||||||
fn main(){
|
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();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user