fix: check client is not nil before closing
This commit is contained in:
parent
bf9a43c1b8
commit
94285cd94d
@ -408,7 +408,13 @@ func (q System) Command(user, cmd string) (output string, err error) {
|
|||||||
flog.Debug().Err(err).Msg("ssh connection")
|
flog.Debug().Err(err).Msg("ssh connection")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer client.Close()
|
defer func() {
|
||||||
|
if client != nil {
|
||||||
|
client.Close()
|
||||||
|
} else {
|
||||||
|
log.Debug().Msg("why client is nil?")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
session, err := client.NewSession()
|
session, err := client.NewSession()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user