Also create pid file in non-daemon mode

Always make a pid file, not only when `-daemon` specified.

This is useful for troubleshooting, for attaching debuggers and loggers
and such.

- Write the pid file only after the datadir lock was acquired
- Don't create or remove a pid file on WIN32, and also don't show the option
This commit is contained in:
Wladimir J. van der Laan
2014-09-20 10:56:25 +02:00
parent 25308337d6
commit d6712db354
4 changed files with 9 additions and 4 deletions

View File

@@ -472,6 +472,7 @@ void ReadConfigFile(map<string, string>& mapSettingsRet,
ClearDatadirCache();
}
#ifndef WIN32
boost::filesystem::path GetPidFile()
{
boost::filesystem::path pathPidFile(GetArg("-pid", "bitcoind.pid"));
@@ -479,7 +480,6 @@ boost::filesystem::path GetPidFile()
return pathPidFile;
}
#ifndef WIN32
void CreatePidFile(const boost::filesystem::path &path, pid_t pid)
{
FILE* file = fopen(path.string().c_str(), "w");