Read the whole file descriptor instead of reading part of it for java -version parsing.
The one-time read sometime fails when the JAVA_TOOL_OPTIONS is set making Bazel unable to detect JDK version.
--
MOS_MIGRATED_REVID=85984806
diff --git a/src/main/cpp/blaze_util.h b/src/main/cpp/blaze_util.h
index 0c006a2..43bc708 100644
--- a/src/main/cpp/blaze_util.h
+++ b/src/main/cpp/blaze_util.h
@@ -64,6 +64,10 @@
// Returns false on error.
bool ReadFile(const string &filename, string *content);
+// Replaces 'content' with contents of file descriptor 'fd'.
+// Returns false on error.
+bool ReadFileDescriptor(int fd, string *content);
+
// Writes 'content' into file 'filename', and makes it executable.
// Returns false on failure, sets errno.
bool WriteFile(const string &content, const string &filename);