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 bazelbuild#20741.

Closes bazelbuild#20752.

PiperOrigin-RevId: 596547046
Change-Id: I4f517b161c03793329d5a4e21ec8ac4a5b53abb0
  • Loading branch information
coeuvre authored and bazel-io committed Jan 24, 2024
1 parent fa0660a commit 69f33cf
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 69f33cf

Please sign in to comment.