diff options
author | Sadie Powell <sadie@witchery.services> | 2024-02-27 10:05:32 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2024-02-27 10:19:36 +0000 |
commit | 9f6d3787559febb48611b1477eaa6a35beadf71a (patch) | |
tree | 82272ed20460fd7760625467c76e89e0c56f1707 /src | |
parent | 642e68f53a146a3d0b143f9a2a3c59af8cb452a3 (diff) |
Fix write_pidfile on Windows.
Microsoft's documentation lies again.
Diffstat (limited to 'src')
-rw-r--r-- | src/init.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp index b974f7cdd..be896ad63 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -221,7 +221,11 @@ static void write_pidfile() std::ofstream stream(pidfile.str()); if (!stream.is_open()) throw CoreException("Can not write to PID file " + pidfile); - stream << getpid() << std::endl; +#ifdef _WIN32 + stream << GetCurrentProcessId() << std::endl; +#else + stream << getpid() << std::endl; +#endif atexit(remove_pidfile); } |