diff options
| author | Han-Wen Nienhuys <hanwen@google.com> | 2013-09-03 10:54:19 -0400 |
|---|---|---|
| committer | Adam Langley <agl@golang.org> | 2013-09-03 10:54:19 -0400 |
| commit | ffadfa66488ddd3d386e89ebb19280aa87c098a6 (patch) | |
| tree | c85c693b278f5a7e226033ee1eda77e0409555d9 /ssh/test | |
| parent | 964142eb526efd9ad5b909a094a5f7f139252c60 (diff) | |
| download | go-x-crypto-ffadfa66488ddd3d386e89ebb19280aa87c098a6.tar.xz | |
go.crypto/ssh/test: Only show SSHD debug output if test fails.
R=agl, dave, jpsugar
CC=golang-dev
https://golang.org/cl/13438043
Diffstat (limited to 'ssh/test')
| -rw-r--r-- | ssh/test/test_unix_test.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ssh/test/test_unix_test.go b/ssh/test/test_unix_test.go index 0d109e2..0c74b33 100644 --- a/ssh/test/test_unix_test.go +++ b/ssh/test/test_unix_test.go @@ -182,9 +182,10 @@ func (s *server) TryDial(config *ssh.ClientConfig) (*ssh.ClientConn, error) { if err != nil { s.t.Fatalf("UnixConn.File: %v", err) } + defer f.Close() s.cmd.Stdin = f s.cmd.Stdout = f - s.cmd.Stderr = os.Stderr + s.cmd.Stderr = &s.output if err := s.cmd.Start(); err != nil { s.t.Fail() s.Shutdown() @@ -206,14 +207,16 @@ func (s *server) Dial(config *ssh.ClientConfig) *ssh.ClientConn { func (s *server) Shutdown() { if s.cmd != nil && s.cmd.Process != nil { - // don't check for Kill error; if it fails it's most likely - // "os: process already finished", and we don't care about that. - s.cmd.Process.Kill() + // Don't check for errors; if it fails it's most + // likely "os: process already finished", and we don't + // care about that. Use os.Interrupt, so child + // processes are killed too. + s.cmd.Process.Signal(os.Interrupt) s.cmd.Wait() } if s.t.Failed() { // log any output from sshd process - s.t.Logf("sshd: %q", s.output.String()) + s.t.Logf("sshd: %s", s.output.String()) } s.cleanup() } |
