From ab4eda59be32314005d64e36b10bbaefbd34ebcc Mon Sep 17 00:00:00 2001 From: meteorgan Date: Sun, 1 Jun 2025 23:56:57 +0800 Subject: [PATCH] close conn after executing limbo in cli --- cli/app.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cli/app.rs b/cli/app.rs index 713e9f717..46a4706c0 100644 --- a/cli/app.rs +++ b/cli/app.rs @@ -176,9 +176,9 @@ impl Limbo { self } - fn first_run(&mut self, sql: Option, quiet: bool) -> io::Result<()> { + fn first_run(&mut self, sql: Option, quiet: bool) -> Result<(), LimboError> { if let Some(sql) = sql { - self.handle_first_input(&sql); + self.handle_first_input(&sql)?; } if !quiet { self.write_fmt(format_args!("Limbo v{}", env!("CARGO_PKG_VERSION")))?; @@ -188,12 +188,13 @@ impl Limbo { Ok(()) } - fn handle_first_input(&mut self, cmd: &str) { + fn handle_first_input(&mut self, cmd: &str) -> Result<(), LimboError> { if cmd.trim().starts_with('.') { self.handle_dot_command(&cmd[1..]); } else { self.run_query(cmd); } + self.close_conn()?; std::process::exit(0); }