Update stderr redirections in scripts#2819
Merged
mrodm merged 2 commits intoelastic:mainfrom Sep 2, 2025
Merged
Conversation
mrodm
commented
Aug 12, 2025
| set -e | ||
|
|
||
| curl -s --cacert /usr/share/kibana/config/certs/ca-cert.pem -f https://localhost:5601/login | grep kbn-injected-metadata 2>&1 >/dev/null | ||
| curl -s --cacert /usr/share/kibana/config/certs/ca-cert.pem -f https://localhost:5601/login | grep kbn-injected-metadata >/dev/null |
Contributor
Author
There was a problem hiding this comment.
I think in these commands it is not needed to use 2>&1, since curl has the silent parameter (-s).
In case it is required, I think in one of these ways:
# redirect the stderr to stdout in the command before pipe
curl -s --cacert /usr/share/kibana/config/certs/ca-cert.pem -f https://localhost:5601/login 2>&1 | grep kbn-injected-metadata > /dev/null
# pipe both stdout and stderr to the stdin of the next command (same as before)
curl -s --cacert /usr/share/kibana/config/certs/ca-cert.pem -f https://localhost:5601/login |& grep kbn-injected-metadata > /dev/null
# using a subshell to run the command
(curl -s --cacert /usr/share/kibana/config/certs/ca-cert.pem -f https://localhost:5601/login | grep kbn-injected-metadata) > /dev/null 2>&1
Collaborator
💛 Build succeeded, but was flaky
Failed CI StepsHistory
cc @mrodm |
mrodm
commented
Aug 12, 2025
Comment on lines
+104
to
+105
| if ! ls ${source} > /dev/null 2>&1; then | ||
| echo "upload_safe_logs: artifacts files not found at ${source}, nothing will be archived" |
Contributor
Author
There was a problem hiding this comment.
Avoid showing the stderr output like:
ls: cannot access 'build/elastic-stack-dump/check-httpjson_false_positive_asserts/logs/elastic-agent-internal/default/*': No such file or directory
upload_safe_logs: artifacts files not found, nothing will be archived
And instead show this message:
upload_safe_logs: artifacts files not found at build/elastic-stack-dump/check-httpjson_false_positive_asserts/logs/elastic-agent-internal/default/*, nothing will be archived
jsoriano
approved these changes
Aug 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates the scripts or commands that redirect stderr to stdout.
For instance, this command does not redirect stderr to stdout as expected, it keeps showing the stderr:
That command should be written as: