MCPcopy Create free account
hub / github.com/ElementsProject/elements / CreatePidFile

Function CreatePidFile

src/init.cpp:150–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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//

Callers 1

AppInitMainFunction · 0.85

Calls 5

GetPidFileFunction · 0.85
InitErrorFunction · 0.85
_Function · 0.85
PathToStringFunction · 0.85
formatFunction · 0.70

Tested by

no test coverage detected