mirror of
https://github.com/nushell/nushell.git
synced 2025-04-09 13:28:50 +02:00
CtrlD exits current shell (#2583)
This commit is contained in:
parent
a5b6bb6209
commit
a508e15efe
@ -315,7 +315,7 @@ fn convert_rustyline_result_to_string(input: Result<String, ReadlineError>) -> L
|
|||||||
match input {
|
match input {
|
||||||
Ok(s) => LineResult::Success(s),
|
Ok(s) => LineResult::Success(s),
|
||||||
Err(ReadlineError::Interrupted) => LineResult::CtrlC,
|
Err(ReadlineError::Interrupted) => LineResult::CtrlC,
|
||||||
Err(ReadlineError::Eof) => LineResult::Break,
|
Err(ReadlineError::Eof) => LineResult::CtrlD,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
outln!("Error: {:?}", err);
|
outln!("Error: {:?}", err);
|
||||||
LineResult::Break
|
LineResult::Break
|
||||||
@ -525,6 +525,13 @@ pub async fn cli(mut context: EvaluationContext) -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LineResult::CtrlD => {
|
||||||
|
context.shell_manager.remove_at_current();
|
||||||
|
if context.shell_manager.is_empty() {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LineResult::Break => {
|
LineResult::Break => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -830,8 +837,9 @@ fn chomp_newline(s: &str) -> &str {
|
|||||||
pub enum LineResult {
|
pub enum LineResult {
|
||||||
Success(String),
|
Success(String),
|
||||||
Error(String, ShellError),
|
Error(String, ShellError),
|
||||||
CtrlC,
|
|
||||||
Break,
|
Break,
|
||||||
|
CtrlC,
|
||||||
|
CtrlD,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn parse_and_eval(line: &str, ctx: &mut EvaluationContext) -> Result<String, ShellError> {
|
pub async fn parse_and_eval(line: &str, ctx: &mut EvaluationContext) -> Result<String, ShellError> {
|
||||||
|
Loading…
Reference in New Issue
Block a user