From f77294c4a1734c339dab63f74453881a55931c68 Mon Sep 17 00:00:00 2001 From: Jordan McClintock Date: Thu, 28 Sep 2023 03:21:14 +0000 Subject: [PATCH] redirect stderr to stdout --- test/e2e/types/test_platform.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/e2e/types/test_platform.go b/test/e2e/types/test_platform.go index 5fecb1c..5e18cf3 100644 --- a/test/e2e/types/test_platform.go +++ b/test/e2e/types/test_platform.go @@ -147,7 +147,7 @@ attemptLoop: errorChan := make(chan error) doneChan := make(chan string) go func() { - stdout, err := ssh.CheckSshCommandE(platform.T, host, fmt.Sprintf(`%v '%v'`, precommand, command)+teeSuffix) + stdout, err := ssh.CheckSshCommandE(platform.T, host, fmt.Sprintf(`%v '%v 2>&1'`, precommand, command)+teeSuffix) if err != nil { errorChan <- err } else { @@ -207,13 +207,13 @@ func readTeeFile(platform *TestPlatform, host ssh.Host, privateKey string, insta sshClient, err := goSsh.Dial("tcp", net.JoinHostPort(instanceIP, "22"), sshConfig) if err != nil { - logger.Default.Logf(platform.T, "error dialing ssh: %v", err) + fmt.Printf("error dialing ssh: %v", err) return } session, err := sshClient.NewSession() if err != nil { - logger.Default.Logf(platform.T, "error creating ssh session: %v", err) + fmt.Printf("error creating ssh session: %v", err) return } defer session.Close() @@ -223,11 +223,11 @@ func readTeeFile(platform *TestPlatform, host ssh.Host, privateKey string, insta err = session.Run(`cat /tmp/terratest-ssh.log && printf "" > /tmp/terratest-ssh.log`) if err != nil { - logger.Default.Logf(platform.T, "error fetching logs: %v", err) + fmt.Printf("error fetching logs: %v", err) return } - logger.Default.Logf(platform.T, b.String()) + fmt.Print(b.String()) } // copyFile copies a file from src to dst. If src and dst files exist, and are