From acbd09421c3b37bd69d2e90402e2bcd7cc9231d7 Mon Sep 17 00:00:00 2001 From: nikhil2611 Date: Fri, 26 Jan 2024 11:46:09 +0530 Subject: [PATCH] added fix for thread error Signed-off-by: nikhil2611 --- lib/winrm/shells/power_shell.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/winrm/shells/power_shell.rb b/lib/winrm/shells/power_shell.rb index d9ca50d2..f2aba67d 100644 --- a/lib/winrm/shells/power_shell.rb +++ b/lib/winrm/shells/power_shell.rb @@ -34,6 +34,9 @@ def finalize(connection_opts, transport, shell_id) end def close_shell(connection_opts, transport, shell_id) + return false unless Thread.current.alive? + + Thread.current.wakeup if Thread.current.status =~ /sleep/ msg = WinRM::WSMV::CloseShell.new( connection_opts, shell_id: shell_id,