Skip to content

Commit

Permalink
Merge pull request #34 from sneal/stop-on-connection-timeout
Browse files Browse the repository at this point in the history
Issue: #27
  • Loading branch information
jpalermo authored Jun 27, 2024
2 parents 72bb051 + 724200c commit 38e21bb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion remotemanager/winrm_clientfactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ func NewWinRmClientFactory(host, username, password string) *WinRMClientFactory

func (f *WinRMClientFactory) Build(timeout time.Duration) (WinRMClient, error) {
endpoint := winrm.NewEndpoint(f.host, WinRmPort, false, true, nil, nil, nil, timeout)
client, err := winrm.NewClient(endpoint, f.username, f.password)
params := winrm.NewParameters(
winrm.DefaultParameters.Timeout,
winrm.DefaultParameters.Locale,
winrm.DefaultParameters.EnvelopeSize,
)
params.AllowTimeout = true
client, err := winrm.NewClientWithParameters(endpoint, f.username, f.password, params)
return client, err
}

0 comments on commit 38e21bb

Please sign in to comment.