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
2 changed files with 19 additions and 2 deletions
14
src/main.rs
14
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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue