From d6aff59c1aad74f5abb91e708987d88ffc51b7cf Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Sun, 8 Sep 2024 14:42:06 +1000 Subject: [PATCH] Add logging for ::drop Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> --- src/process_impl/session.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/process_impl/session.rs b/src/process_impl/session.rs index c9d021865..7188ffc6a 100644 --- a/src/process_impl/session.rs +++ b/src/process_impl/session.rs @@ -226,10 +226,14 @@ impl Drop for Session { None => return, }; - let _ = self + let _res = self .new_std_cmd(&["-O", "exit"]) .stdout(Stdio::null()) .stderr(Stdio::null()) .status(); + #[cfg(feature = "tracing")] + if let Err(err) = _res { + tracing::error!("Closing ssh session failed: {}", err); + } } }