fix(connector): handle nil stdout writer in WinRM Run

What does this MR do?

winRMClient.Run passes opts.Stdout straight to the winrm library, which copies command output to stdout unconditionally. When Stdout is nil (for example, GitLab Runner's instance_ready_command path), this panics with a nil pointer dereference. This MR defaults a nil Stdout to io.Discard, the same way a nil Stderr is already handled.

Tests

Adds connector/winrm_test.go with a fake WinRM SOAP transport:

  • TestWinRMRunNilWriters: runs a command with nil Stdout/Stderr. Without the fix this panics (invalid memory address or nil pointer dereference); with the fix it passes.
  • TestWinRMRunWritesStdout: checks that output is still written to a provided Stdout.

Local results: go test ./... -count=1 passes. golangci-lint run ./connector/... reports only two existing modernize findings on lines this MR doesn't touch.

This doesn't overlap with !117 (merged), which covers stderr handling.

Closes #66 (closed)

AI disclosure: this change was prepared with AI assistance and reviewed and tested before submission.

Merge request reports

Loading
Loading