| 148 | } |
| 149 | |
| 150 | [[nodiscard]] static bool CreatePidFile(const ArgsManager& args) |
| 151 | { |
| 152 | std::ofstream file{GetPidFile(args)}; |
| 153 | if (file) { |
| 154 | #ifdef WIN32 |
| 155 | tfm::format(file, "%d\n", GetCurrentProcessId()); |
| 156 | #else |
| 157 | tfm::format(file, "%d\n", getpid()); |
| 158 | #endif |
| 159 | return true; |
| 160 | } else { |
| 161 | return InitError(strprintf(_("Unable to create the PID file '%s': %s"), fs::PathToString(GetPidFile(args)), std::strerror(errno))); |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | ////////////////////////////////////////////////////////////////////////////// |
| 166 | // |
no test coverage detected