Skip to content

Commit dd9ac13

Browse files
Googlercopybara-github
Googler
authored andcommitted
Fix a bug when a relative path is used for the execution log
Fixes bazelbuild#8364 RELNOTES: None PiperOrigin-RevId: 248786565
1 parent d5b163e commit dd9ac13

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/main/java/com/google/devtools/build/lib/bazel/SpawnLogModule.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private void initOutputs(CommandEnvironment env) throws IOException {
9191

9292
AsynchronousFileOutputStream outStream = null;
9393
if (executionOptions.executionLogFile != null) {
94-
rawOutput = env.getRuntime().getFileSystem().getPath(executionOptions.executionLogFile);
94+
rawOutput = workingDirectory.getRelative(executionOptions.executionLogFile);
9595
outStream =
9696
new AsynchronousFileOutputStream(
9797
workingDirectory.getRelative(executionOptions.executionLogFile));

src/test/shell/bazel/bazel_execlog_test.sh

+12
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,16 @@ EOF
107107
fi
108108
}
109109

110+
function test_dir_relative() {
111+
cat > BUILD <<'EOF'
112+
genrule(
113+
name = "rule",
114+
outs = ["out.txt"],
115+
cmd = "echo hello > $(location out.txt)"
116+
)
117+
EOF
118+
bazel build //:all --experimental_execution_log_file output 2>&1 >> $TEST_log || fail "could not build"
119+
wc output || fail "no output produced"
120+
}
121+
110122
run_suite "execlog_tests"

0 commit comments

Comments
 (0)