From 7526ba9d6fc4221a338056802f8456733da314d6 Mon Sep 17 00:00:00 2001 From: Neil Svedberg Date: Mon, 6 Jan 2025 14:20:52 -0500 Subject: [PATCH] Add header to console When the console is launched, it now prints this message: conduwuit VERSION admin console "help" for help, ^D to exit the console, ^\ to stop the server --- src/service/admin/console.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/service/admin/console.rs b/src/service/admin/console.rs index 0edcd2f3..de201f4b 100644 --- a/src/service/admin/console.rs +++ b/src/service/admin/console.rs @@ -58,6 +58,7 @@ impl Console { pub async fn close(self: &Arc) { self.interrupt(); + let Some(worker_join) = self.worker_join.lock().expect("locked").take() else { return; }; @@ -92,6 +93,12 @@ impl Console { #[tracing::instrument(skip_all, name = "console", level = "trace")] async fn worker(self: Arc) { debug!("session starting"); + + self.output + .print_inline(&format!("**conduwuit {}** admin console\n", conduwuit::version())); + self.output + .print_text("\"help\" for help, ^D to exit the console, ^\\ to stop the server\n"); + while self.server.running() { match self.readline().await { | Ok(event) => match event { @@ -147,6 +154,7 @@ impl Console { self.add_history(line.clone()); let future = self.clone().process(line); + let (abort, abort_reg) = AbortHandle::new_pair(); let future = Abortable::new(future, abort_reg); _ = self.command_abort.lock().expect("locked").insert(abort);