Fix handling of EOF keystroke

next
Sayan Nandan 3 years ago
parent 82420e2013
commit 81c3479ffb
No known key found for this signature in database
GPG Key ID: 8BC07A0A4D41DD52

@ -11,7 +11,8 @@ All changes in this project will be noted in this file.
### Fixes
- Added error code output for new error codes which otherwise printed "Unknown error"
- (skysh) Added error code output for new error codes which otherwise printed "Unknown error"
- (skysh) Fixed handling of EOF keystroke
## Version 0.7.4

@ -24,21 +24,17 @@
*
*/
use crate::runner::Runner;
use crate::tokenizer;
use clap::load_yaml;
use clap::App;
use crossterm::terminal::{Clear, ClearType};
use crossterm::{cursor, execute};
use libsky::URL;
use libsky::VERSION;
use readline::config::Configurer;
use readline::{error::ReadlineError, Editor};
use crate::{runner::Runner, tokenizer};
use clap::{load_yaml, App};
use crossterm::{
cursor, execute,
terminal::{Clear, ClearType},
};
use libsky::{URL, VERSION};
use readline::{config::Configurer, error::ReadlineError, Editor};
use rustyline as readline;
use skytable::Pipeline;
use skytable::Query;
use std::io::stdout;
use std::process;
use skytable::{Pipeline, Query};
use std::{io::stdout, process};
const ADDR: &str = "127.0.0.1";
const SKYSH_HISTORY_FILE: &str = ".sky_history";
@ -155,7 +151,7 @@ pub async fn start_repl() {
match editor.load_history(SKYSH_HISTORY_FILE) {
Ok(_) => {}
Err(e) => match e {
rustyline::error::ReadlineError::Io(e) if e.kind() == std::io::ErrorKind::NotFound => {
ReadlineError::Io(e) if e.kind() == std::io::ErrorKind::NotFound => {
println!("{}", SKY_WELCOME)
}
_ => fatal!("Failed to read history file with error: {}", e),
@ -251,7 +247,7 @@ pub async fn start_repl() {
}
}
}
Err(ReadlineError::Interrupted) => break,
Err(ReadlineError::Interrupted | ReadlineError::Eof) => break,
Err(err) => fatal!("ERROR: Failed to read line with error: {}", err),
}
}

Loading…
Cancel
Save