Skip to content

add RunCommandAndGetStdOutErr#1482

Merged
james00012 merged 3 commits intomainfrom
stdout-and-stderr
Dec 20, 2024
Merged

add RunCommandAndGetStdOutErr#1482
james00012 merged 3 commits intomainfrom
stdout-and-stderr

Conversation

@james00012
Copy link
Copy Markdown
Contributor

Description

Fixes #1228.

TODOs

Read the Gruntwork contribution guidelines.

  • Update the docs.
  • Run the relevant tests successfully, including pre-commit checks.
  • Ensure any 3rd party code adheres with our license policy or delete this line if its not applicable.
  • Include release notes. If this PR is backward incompatible, include a migration guide.

Release Notes (draft)

Added / Removed / Updated [X].

Migration Guide

@james00012 james00012 requested a review from denis256 as a code owner December 6, 2024 03:57
@james00012 james00012 self-assigned this Dec 6, 2024
func RunCommandAndGetStdOutErrE(t testing.TestingT, command Command) (stdout string, stderr string, err error) {
output, err := runCommand(t, command)
if err != nil {
return output.Stdout(), output.Stderr(), &ErrWithCmdOutput{err, output}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'output' might have 'nil' value?

In some cases can be returned error and nil...

https://github.com/gruntwork-io/terratest/blob/main/modules/shell/command.go#L109

it may require to change in multiple places

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Will address this in a follow-up PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@james00012 james00012 merged commit 926fff7 into main Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Order of combined output form shell.RunCommandAndGetOutputE

2 participants