Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

Commit

Permalink
redirect stderr to stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
corang committed Sep 28, 2023
1 parent 03b1dcf commit f77294c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/e2e/types/test_platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()
Expand All @@ -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
Expand Down

0 comments on commit f77294c

Please sign in to comment.