aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules
diff options
context:
space:
mode:
authorGravatar Han-Wen Nienhuys <hanwen@google.com>2015-02-18 16:59:12 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-02-18 16:59:12 +0000
commit2c41b59388d0cacc0202d0d470100db87dc5a1ab (patch)
treeac7484b9b8c828dfa6c6a072d9471dbd3439bb64 /src/main/java/com/google/devtools/build/lib/rules
parentcbe004a0f76e60081b9fd0112e325a2f9d3d86cc (diff)
Add OutErr#close, and call that in test strategies.
This fixes "Text file is busy" when trying to execute log files for local tests just after blaze finishes. -- MOS_MIGRATED_REVID=86597766
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/test/StandaloneTestStrategy.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/test/StandaloneTestStrategy.java b/src/main/java/com/google/devtools/build/lib/rules/test/StandaloneTestStrategy.java
index d452afba72..72970a83ae 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/test/StandaloneTestStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/test/StandaloneTestStrategy.java
@@ -91,9 +91,10 @@ public class StandaloneTestStrategy extends TestStrategy {
Executor executor = actionExecutionContext.getExecutor();
ResourceSet resources = null;
+ FileOutErr fileOutErr = null;
try {
FileSystemUtils.createDirectoryAndParents(workingDirectory);
- FileOutErr fileOutErr = new FileOutErr(action.getTestLog().getPath(),
+ fileOutErr = new FileOutErr(action.getTestLog().getPath(),
action.resolve(actionExecutionContext.getExecutor().getExecRoot()).getTestStderr());
resources = action.getTestProperties().getLocalResourceUsage();
@@ -109,6 +110,13 @@ public class StandaloneTestStrategy extends TestStrategy {
if (resources != null) {
ResourceManager.instance().releaseResources(action, resources);
}
+ try {
+ if (fileOutErr != null) {
+ fileOutErr.close();
+ }
+ } catch (IOException e) {
+ // If the close fails, there is little we can do.
+ }
}
}