Exit on STDIN EOF
This commit is contained in:
parent
f176bdce91
commit
9002fa3b35
@ -1,5 +1,5 @@
|
||||
use std::{
|
||||
env::{current_dir, set_current_dir}, io::{self, Write}, path::{Component, Path, PathBuf}, process::Command
|
||||
env::{current_dir, set_current_dir}, io::{self, Write}, path::PathBuf, process::Command
|
||||
};
|
||||
|
||||
use clap::Parser;
|
||||
@ -28,7 +28,10 @@ fn main() {
|
||||
);
|
||||
io::stdout().lock().flush().unwrap();
|
||||
line.clear();
|
||||
io::stdin().read_line(&mut line).unwrap();
|
||||
if io::stdin().read_line(&mut line).unwrap() == 0 {
|
||||
// EOF
|
||||
return;
|
||||
}
|
||||
let line = line.trim();
|
||||
if line.is_empty() {
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user