x/crypto/ssh: handle missing exit status more gracefully.

According to RFC 4254 section 6.10, SSH server implementations may
omit the exit-status and exit-signal messages.  If this happens, we
now return &ExitMissingError{}, so clients can handle this case
specifically.

This came up in the discussion of issue #16194.

Change-Id: Iae5e916b18aa5bd8e95618e9fcfcab8b19e147d9
Reviewed-on: https://go-review.googlesource.com/24727
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/ssh/session_test.go b/ssh/session_test.go
index f7f0f76..f35a378 100644
--- a/ssh/session_test.go
+++ b/ssh/session_test.go
@@ -297,7 +297,6 @@
 	}
 }
 
-// Test WaitMsg is not returned if the channel closes abruptly.
 func TestExitWithoutStatusOrSignal(t *testing.T) {
 	conn := dial(exitWithoutSignalOrStatus, t)
 	defer conn.Close()
@@ -313,11 +312,8 @@
 	if err == nil {
 		t.Fatalf("expected command to fail but it didn't")
 	}
-	_, ok := err.(*ExitError)
-	if ok {
-		// you can't actually test for errors.errorString
-		// because it's not exported.
-		t.Fatalf("expected *errorString but got %T", err)
+	if _, ok := err.(*ExitMissingError); !ok {
+		t.Fatalf("got %T want *ExitMissingError", err)
 	}
 }