From a9836cb181d6292c0e53c28eabe10fd4a1e0536f Mon Sep 17 00:00:00 2001 From: Dominik Nakamura Date: Wed, 13 Dec 2023 10:45:04 +0900 Subject: [PATCH] fix(lsp): solve the hanging shutdown problem The connection instance was kept alive, which caused the background threads to idle as they were waiting for all channels to be dropped. --- crates/stef-lsp/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/stef-lsp/src/main.rs b/crates/stef-lsp/src/main.rs index fe3f4cc..e4cefe2 100644 --- a/crates/stef-lsp/src/main.rs +++ b/crates/stef-lsp/src/main.rs @@ -371,7 +371,7 @@ fn main() -> Result<()> { let cli = Cli::parse(); logging::init(None)?; - let (connection, _io_threads) = if cli.stdio { + let (connection, io_threads) = if cli.stdio { Connection::stdio() } else if let Some(file) = cli.pipe { unimplemented!("open connection on pipe/socket {file:?}"); @@ -403,8 +403,8 @@ fn main() -> Result<()> { return Err(e); } - // TODO: investigate why this hangs - // io_threads.join()?; + drop(connection); + io_threads.join()?; info!("goodbye!");