improve ControlMaster error reporting (#30631)

This commit is contained in:
Forrest 2023-08-18 08:21:18 -07:00 committed by GitHub
parent d5c27ea086
commit 37e18d94b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4463,15 +4463,12 @@ func testExternalClient(t *testing.T, suite *integrationTestSuite) {
if tt.outError {
require.Error(t, err)
} else {
if err != nil {
// If an *exec.ExitError is returned, parse it and return stderr. If this
// is not done then c.Assert will just print a byte array for the error.
er, ok := err.(*exec.ExitError)
if ok {
t.Fatalf("Unexpected error: %v", string(er.Stderr))
}
// ensure stderr is printed as a string rather than bytes
var stderr string
if e, ok := err.(*exec.ExitError); ok {
stderr = string(e.Stderr)
}
require.NoError(t, err)
require.NoError(t, err, "stderr=%q", stderr)
require.Equal(t, tt.outExecOutput, strings.TrimSpace(string(output)))
}
})