Skip to content

Commit

Permalink
pip stderr from relayer executable
Browse files Browse the repository at this point in the history
  • Loading branch information
cam-schultz committed Oct 4, 2023
1 parent ef9860c commit a565a1a
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tests/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,31 @@ func RunRelayerExecutable(ctx context.Context, relayerConfigPath string) (*exec.
relayerCmd := exec.CommandContext(relayerContext, "./build/awm-relayer", "--config-file", relayerConfigPath)

// Set up a pipe to capture the command's output
cmdReader, _ := relayerCmd.StdoutPipe()
cmdStdOutReader, err := relayerCmd.StdoutPipe()
Expect(err).Should(BeNil())
cmdStdErrReader, err := relayerCmd.StderrPipe()
Expect(err).Should(BeNil())

// Start the command
log.Info("Starting the relayer executable")
err := relayerCmd.Start()
err = relayerCmd.Start()
Expect(err).Should(BeNil())

// Start a goroutine to read and output the command's stdout
// Start goroutines to read and output the command's stdout and stderr
go func() {
scanner := bufio.NewScanner(cmdReader)
scanner := bufio.NewScanner(cmdStdOutReader)
for scanner.Scan() {
log.Info(scanner.Text())
}
cmdOutput <- "Command execution finished"
}()
go func() {
scanner := bufio.NewScanner(cmdStdErrReader)
for scanner.Scan() {
log.Error(scanner.Text())
}
cmdOutput <- "Command execution finished"
}()
return relayerCmd, relayerCancel
}

Expand Down

0 comments on commit a565a1a

Please sign in to comment.