aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp
diff options
context:
space:
mode:
authorGravatar Klaus Aehlig <aehlig@google.com>2018-07-23 06:39:32 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-07-23 06:40:31 -0700
commit6bc22d571b17853a7e6c2c4b6776a1c833c63ce3 (patch)
tree275d7b663158195a1db929c2aaf449dc3ec0a4eb /src/main/cpp
parentedc33762fa3fbbcbb0a295bd7f81bb0b7320ed54 (diff)
blaze.cc: add missing fflush(3) before execve(2)
When calling `bazel run` the command itself is executed by the client. As an execve(2) replaces the program image, including all buffered IO, flush all streams first. This will ensure that the "Running command line" message is actually printed. Change-Id: Ie18185bac4ed82a2725c75f97d3c64bd3003690b PiperOrigin-RevId: 205652760
Diffstat (limited to 'src/main/cpp')
-rw-r--r--src/main/cpp/blaze.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/cpp/blaze.cc b/src/main/cpp/blaze.cc
index 739dc20ff8..fe44107666 100644
--- a/src/main/cpp/blaze.cc
+++ b/src/main/cpp/blaze.cc
@@ -1915,6 +1915,10 @@ unsigned int GrpcBlazeServer::Communicate() {
<< "changing directory into " << request.working_directory()
<< " failed: " << GetLastErrorString();
}
+
+ // Execute the requested program, but before doing so, flush everything
+ // we still have to say.
+ fflush(NULL);
ExecuteProgram(request.argv(0), argv);
}