switch to crate rustyline_async

improve console signal and interrupt stack

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-06-16 19:42:16 +00:00
parent 959fd2e6c4
commit 5aee03d14a
5 changed files with 137 additions and 115 deletions

View file

@ -130,7 +130,6 @@ impl Service {
let receiver = self.receiver.lock().await;
let mut signals = services().server.signal.subscribe();
loop {
debug_assert!(!receiver.is_closed(), "channel closed");
tokio::select! {
command = receiver.recv_async() => match command {
Ok(command) => self.handle_command(command).await,
@ -146,10 +145,7 @@ impl Service {
async fn handle_signal(&self, #[allow(unused_variables)] sig: &'static str) {
#[cfg(feature = "console")]
if sig == "SIGINT" && services().server.running() {
self.console.interrupt();
self.console.start().await;
}
self.console.handle_signal(sig).await;
}
async fn handle_command(&self, command: Command) {