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

Protect logged exec spooling from no output #42177

Merged
merged 1 commit into from
May 16, 2019

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented May 16, 2019

This commit adds a guard around reading the spooled LoggedExec output.
It is possible the exec command did not output anything, and failed,
which would trigger a failure to read the output file.

This commit adds a guard around reading the spooled LoggedExec output.
It is possible the exec command did not output anything, and failed,
which would trigger a failure to read the output file.
@rjernst rjernst added >bug :Delivery/Build Build or test infrastructure v8.0.0 v7.2.0 labels May 16, 2019
@rjernst rjernst requested a review from mark-vieira May 16, 2019 14:31
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@rjernst
Copy link
Member Author

rjernst commented May 16, 2019

@elasticmachine run elasticsearch-ci/2

Copy link
Contributor

@mark-vieira mark-vieira left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@@ -63,7 +63,10 @@ public void setSpoolOutput(boolean spoolOutput) {
out = new LazyFileOutputStream(spoolFile);
outputLogger = logger -> {
try {
Files.lines(spoolFile.toPath()).forEach(logger::error);
// the file may not exist if the command never output anything
if (Files.exists(spoolFile.toPath())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any real benefit in doing Files.exists(spoolFile.toPath) vs simply spoolFile.exists()?

@rjernst rjernst merged commit 4496794 into elastic:master May 16, 2019
@rjernst rjernst deleted the distro_tests8 branch May 16, 2019 19:38
rjernst added a commit that referenced this pull request May 16, 2019
This commit adds a guard around reading the spooled LoggedExec output.
It is possible the exec command did not output anything, and failed,
which would trigger a failure to read the output file.
gurkankaymak pushed a commit to gurkankaymak/elasticsearch that referenced this pull request May 27, 2019
This commit adds a guard around reading the spooled LoggedExec output.
It is possible the exec command did not output anything, and failed,
which would trigger a failure to read the output file.
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team v7.2.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants