-
Notifications
You must be signed in to change notification settings - Fork 140
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
sam build dotnet core sends normal output to STDERR #199
Comments
Don't know if this is related, but when you execute |
@abelperezok Thanks for raising this! would you consider a general rule that all workflows would need to get all their output over to stdout? |
@sriram-mv Yes, I'd consider a general rule to get all workloads output to stdout, I'm not sure how complex it is internally but ideally only errors should go to stderr as it can confuse the caller process about the invocation outcome. |
Hi @abelperezok , When I checked for dotnet workflow, I saw that we are piping the output of the dotnet CLI that we run for the build.
Since we are just piping whatever output comes from the underlying CLI that we run, could this be coming from dotnet CLI? |
Description
When running sam build on a dotnet core lambda project, most of the output is sent to STDERR as opposed to STDOUT. This can be particularly confusing when running this command as part of a CI pipeline such as Azure DevOps as it can fail the step for no good reason.
Steps to reproduce
Run sam build and at glance all the output seems ok, but it's sending a big chunk of output to STDERR.
Observed result
Following a trick found in another thread azure-pipelines-tasks/issues/6840 I can see that most of the output is actually sent to STDERR.
The trick is to add
2> >(while read line; do (>&2 echo "STDERROR: $line"); done)
at the end of the command and it will prepend "STDERROR: " to each line sent to STDERR.Another simpler way to test it is to get rid of the error log by redirecting to null:
Only a few lines are displayed as normal standard output.
Expected result
No output sent to STDERR unless it's actually an error with the command.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
:The text was updated successfully, but these errors were encountered: