Skip to content

Commit

Permalink
Close test.err before deleteing it
Browse files Browse the repository at this point in the history
Unfortuantely, there isn't an easy way to add integration test for this specific edge case on Windows.

Fixes #20741.

Closes #20752.

PiperOrigin-RevId: 596547046
Change-Id: I4f517b161c03793329d5a4e21ec8ac4a5b53abb0
  • Loading branch information
coeuvre authored and copybara-github committed Jan 8, 2024
1 parent 8e8ddab commit 958e0c4
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,12 @@ private TestAttemptResult runTestAttempt(
// Make sure that the test.log exists.Spaw
FileSystemUtils.touchFile(fileOutErr.getOutputPath());
}
fileOutErr.close();
// Append any error output to the test.log. This is very rare.
//
// Only write after the error output stream has been closed. Otherwise, Bazel cannot delete
// test.err file on Windows. See https://github.com/bazelbuild/bazel/issues/20741.
writeOutFile(fileOutErr.getErrorPath(), fileOutErr.getOutputPath());
fileOutErr.close();
if (streamed != null) {
streamed.close();
}
Expand Down

0 comments on commit 958e0c4

Please sign in to comment.