| 48 | using json = nlohmann::json; |
| 49 | |
| 50 | void lockDataDirectory(const blocksci::DataConfiguration &dataConfig) { |
| 51 | filesystem::path pidFile = dataConfig.pidFilePath(); |
| 52 | |
| 53 | if(pidFile.exists()) { |
| 54 | std::cout << "A PID file exists in the data directory, another parser instance might already be running. Aborting." << std::endl; |
| 55 | exit(1); |
| 56 | } else { |
| 57 | std::cout << "Locking data directory." << std::endl; |
| 58 | std::ofstream rawFile(pidFile.str()); |
| 59 | rawFile << getpid(); |
| 60 | rawFile.close(); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | void lockDataDirectory(const ParserConfigurationBase &config) { |
| 65 | lockDataDirectory(config.dataConfig); |
no test coverage detected