-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Conversation
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.
Pinging @elastic/es-core-infra |
@elasticmachine run elasticsearch-ci/2 |
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.
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())) { |
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.
Is there any real benefit in doing Files.exists(spoolFile.toPath)
vs simply spoolFile.exists()
?
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.
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.