aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/server
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2016-04-25 11:17:31 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2016-04-25 11:32:23 +0000
commit5a78166ee4edbd295f5d5fdb94785025285e764b (patch)
tree45c08efc2536a6235f60290a4e23e961252ac335 /src/main/java/com/google/devtools/build/lib/server
parent523f79fea313e4fbc15b779994029d747b3f18a7 (diff)
Write the server.pid file from C++ instead of Java.
This is because OsUtils.getpid() cannot work under msys2 since java.exe is not an msys2 binary. We might make it work by including JNI code, but the current plan is to go without JNI on Windows. -- MOS_MIGRATED_REVID=120694746
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/server')
-rw-r--r--src/main/java/com/google/devtools/build/lib/server/RPCServer.java10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/server/RPCServer.java b/src/main/java/com/google/devtools/build/lib/server/RPCServer.java
index 6c6a8429ea..1997498209 100644
--- a/src/main/java/com/google/devtools/build/lib/server/RPCServer.java
+++ b/src/main/java/com/google/devtools/build/lib/server/RPCServer.java
@@ -15,8 +15,6 @@ package com.google.devtools.build.lib.server;
import com.google.devtools.build.lib.runtime.CommandExecutor;
import com.google.devtools.build.lib.util.Clock;
-import com.google.devtools.build.lib.util.OsUtils;
-import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.Path;
import java.io.IOException;
@@ -41,17 +39,11 @@ public abstract class RPCServer {
}
protected RPCServer(Path serverDirectory) throws IOException {
- // We create the server.pid file strictly before binding the socket.
+ // server.pid was written in the C++ launcher after fork() but before exec() .
// The client only accesses the pid file after connecting to the socket
// which ensures that it gets the correct pid value.
Path pidFile = serverDirectory.getRelative("server.pid");
RPCServer.deleteAtExit(pidFile, /*deleteParent=*/ false);
- try {
- pidFile.delete();
- } catch (IOException e) {
- // Ignore.
- }
- FileSystemUtils.writeContentAsLatin1(pidFile, String.valueOf(OsUtils.getpid()));
}
/**