go.crypto/ssh/test: don't kill process if it was never started

This case arises if s.cmd.Start fails when called by
server.Dial.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6821097
This commit is contained in:
Ian Lance Taylor
2012-11-08 09:08:33 -08:00
parent 6779fad1d0
commit 153731a6de
+4 -2
View File
@@ -193,8 +193,10 @@ func (s *server) Dial(config *ssh.ClientConfig) *ssh.ClientConn {
}
func (s *server) Shutdown() {
if err := s.cmd.Process.Kill(); err != nil {
s.t.Error(err)
if s.cmd.Process != nil {
if err := s.cmd.Process.Kill(); err != nil {
s.t.Error(err)
}
}
if s.t.Failed() {
// log any output from sshd process