diff options
author | Lukacs Berki <lberki@google.com> | 2016-04-28 11:04:59 +0000 |
---|---|---|
committer | Yun Peng <pcloudy@google.com> | 2016-04-28 11:27:55 +0000 |
commit | e33cf0fb5306ad52d0066128a85bcd3b2e3f2ac8 (patch) | |
tree | a32a5fd756635b74979b43f77fc29d5a8d9956f4 /src/main/cpp/blaze_util_mingw.cc | |
parent | 750656430d4a67b988ea8a9b14753617574b9874 (diff) |
*really* make server mode on Windows work.
This is still fallout from a bad merge I did yesterday.
More progress towards #930.
--
MOS_MIGRATED_REVID=121006319
Diffstat (limited to 'src/main/cpp/blaze_util_mingw.cc')
-rw-r--r-- | src/main/cpp/blaze_util_mingw.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/cpp/blaze_util_mingw.cc b/src/main/cpp/blaze_util_mingw.cc index 136068d601..bdb8362b2b 100644 --- a/src/main/cpp/blaze_util_mingw.cc +++ b/src/main/cpp/blaze_util_mingw.cc @@ -289,7 +289,7 @@ static bool DaemonizeOnWindows() { } int ExecuteDaemon(const string& exe, const std::vector<string>& args_vector, - const string& daemon_output, const string& pid_file) { + const string& daemon_output, const string& server_dir) { if (DaemonizeOnWindows()) { // We are the client process // TODO(lberki): -1 is only an in-band signal that tells that there is no @@ -364,7 +364,13 @@ int ExecuteDaemon(const string& exe, const std::vector<string>& args_vector, CloseHandle(pipe_write); CloseHandle(pipe_read); - WriteFile(ToString(GetProcessId(processInfo.hProcess)), pid_file); + string pid_string = ToString(getpid()); + string pid_file = blaze_util::JoinPath(server_dir, ServerPidFile()); + if (!WriteFile(pid_string, pid_file)) { + // Not a lot we can do if this fails + fprintf(stderr, "Cannot write PID file %s\n", pid_file.c_str()); + } + CloseHandle(processInfo.hProcess); CloseHandle(processInfo.hThread); |