Skip to content

Commit

Permalink
[7.1.0] Close test.err before deleteing it (#21020)
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.

Commit
958e0c4

PiperOrigin-RevId: 596547046
Change-Id: I4f517b161c03793329d5a4e21ec8ac4a5b53abb0

Co-authored-by: Chi Wawng <coeuvre@gmail.com>
  • Loading branch information
bazel-io and coeuvre authored Jan 29, 2024
1 parent d3506e7 commit 7cfe252
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -808,9 +808,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 7cfe252

Please sign in to comment.