From 8350aced396e610f70d2cc7a1997e81a8b5407ee Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 5 Jul 2024 01:27:13 +0000 Subject: [PATCH] add ctrl-\ quit support to admin console Signed-off-by: Jason Volk --- Cargo.lock | 3 +-- Cargo.toml | 3 ++- src/service/admin/console.rs | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f89c9f35..563b87ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3274,8 +3274,7 @@ checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "rustyline-async" version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6eb06391513b2184f0a5405c11a4a0a5302e8be442f4c5c35267187c2b37d5" +source = "git+https://github.com/girlbossceo/rustyline-async?rev=de26100b0db03e419a3d8e1dd26895d170d1fe50#de26100b0db03e419a3d8e1dd26895d170d1fe50" dependencies = [ "crossterm", "futures-channel", diff --git a/Cargo.toml b/Cargo.toml index 44f43849..166a359d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -404,7 +404,8 @@ features = [ ] [workspace.dependencies.rustyline-async] -version = "0.4.2" +git = "https://github.com/girlbossceo/rustyline-async" +rev = "de26100b0db03e419a3d8e1dd26895d170d1fe50" [workspace.dependencies.termimad] version = "0.29.4" diff --git a/src/service/admin/console.rs b/src/service/admin/console.rs index c0562c52..3d96e078 100644 --- a/src/service/admin/console.rs +++ b/src/service/admin/console.rs @@ -97,6 +97,7 @@ impl Console { ReadlineEvent::Line(string) => self.clone().handle(string).await, ReadlineEvent::Interrupted => continue, ReadlineEvent::Eof => break, + ReadlineEvent::Quit => services().server.shutdown().unwrap_or_else(error::log), }, Err(error) => match error { ReadlineError::Closed => break,