Skip to content

Commit

Permalink
Backport winrm panic workaround
Browse files Browse the repository at this point in the history
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
  • Loading branch information
kke committed Jun 5, 2024
1 parent 566086e commit d79e782
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions winrm.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,16 @@ type Command struct {

// Wait blocks until the command finishes
func (c *Command) Wait() error {
defer func() {
if r := recover(); err == nil && r != nil {

Check failure on line 202 in winrm.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: err (typecheck)

Check failure on line 202 in winrm.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: err) (typecheck)

Check failure on line 202 in winrm.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: err) (typecheck)

Check failure on line 202 in winrm.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: err) (typecheck)

Check failure on line 202 in winrm.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: err) (typecheck)

Check failure on line 202 in winrm.go

View workflow job for this annotation

GitHub Actions / windows

undefined: err

Check failure on line 202 in winrm.go

View workflow job for this annotation

GitHub Actions / unit-linux

undefined: err
if strings.Contains(fmt.Sprint(r), "close of closed channel") {
log.Debugf("recovered from a panic in Command.Wait: %v", r)
} else {
panic(r)
}
}
}()

defer c.sh.Close()
defer c.cmd.Close()

Expand Down

0 comments on commit d79e782

Please sign in to comment.