diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index c592e51..42fa2a9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,9 +21,16 @@ fn eval(paths: &[&str], prompt: &str) { // Wait for user input let mut input = String::new(); - io::stdin() + let bytes = io::stdin() .read_line(&mut input) .expect("Unable to evaluate the input string"); + + // Check if we've reached EOF (i.e. <C-d>) + if bytes == 0 { + break; + } + + // Trim the input let input = input.trim(); // Check if user wants to exit the shell |