-
Notifications
You must be signed in to change notification settings - Fork 126
Update stderr redirections in scripts #2819
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
base: main
Are you sure you want to change the base?
Conversation
@@ -2,5 +2,5 @@ | |||
|
|||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
💛 Build succeeded, but was flaky
Failed CI StepsHistory
cc @mrodm |
if ! ls ${source} > /dev/null 2>&1; then | ||
echo "upload_safe_logs: artifacts files not found at ${source}, nothing will be archived" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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: