-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support terminating a session with running commands #315
Comments
My suspicion is that this is a byproduct of calling I'm sure we could do some work to make this gem more thread safe, but I also think there is a workaround you could try. Try explicitly calling |
Thanks very much for putting thought into the problem @mwrock I did try calling Looking at that error a second time, it does come from the wmrv/cleanup_command constructor and aside from tracing what's happening exactly with What I'm adding in inspec/train-winrm#27 is going to be an "emergency brake" - if you reach this timeout you are in an error state, you are going to get an exception, and you need to code some fix to not reach the timeout next time. |
I'm looking at the stack trace again and now noticing it is coming from an |
I've submitted #316 which would squash the annoying runtime error but, as mentioned in that PR, still does not ultimately address this issue. You would continue to run the risk of a command running indefinitely on a remote machine although the shell is closed. One thing you might consider is using an elevated shell and setting its |
Thanks @mwrock ! |
I have a customer request to be able to apply a timeout to commands, where we're using this library for PowerShell shells over WinRM.
When I try to send a command in one thread then have another thread call
close
, it terminates the running command as I want but it always throws this exceptionI'm unsure on first impression how this exception is possible when
close
will immediately return if there is noshell_id
It would be great to have a supported method for terminating a session when a command was running - even if it is understood to be an emergency brake with indeterminable side effects.
The text was updated successfully, but these errors were encountered: