Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print output when executing commands when exit code != 0 #540

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Madrigal
Copy link
Contributor

Issue #, if available:

Description of changes:

We had an issue where we had a hard time figuring out what the error was when running a test. Test was failing with

> Task :smithy-go-codegen:test

GenerateStandaloneGoModuleTest > testGenerateGoModule() FAILED
    java.lang.Exception at GenerateStandaloneGoModuleTest.java:93

75 tests completed, 1 failed

> Task :smithy-go-codegen:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':smithy-go-codegen:test'.
> There were failing tests. See the report at: file://place/smithy-go/codegen/smithy-go-codegen/build/reports/tests/test/index.html

and the test report had just

java.lang.Exception: Command existed with non-zero code, [go1.20.14, test, -v, ./...], status code: 1

Since the logger does not print to the HTML result, we miss whatever was printed to stdout and stderr. With this change, the report now has

java.lang.Exception: Command existed with non-zero code, [go1.20.14, test, -v, ./...], status code: 1 
output: stdout:  
stderr: go: errors parsing go.mod:
/private/var/folders/lj/djm7pnwn1cn9whm2yfnvxm_m0000gr/T/software.amazon.smithy.go.codegen.GenerateStandaloneGoModuleTest326470907733827070/go.mod:5: 
unknown directive: toolchain

Which would have been more useful to identify what the issue was on our local tooling

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Madrigal Madrigal requested review from a team as code owners September 20, 2024 19:59
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.

2 participants