| 398 | } |
| 399 | |
| 400 | pid_t Application::StartReloadProcess() |
| 401 | { |
| 402 | // prepare arguments |
| 403 | ArrayData args; |
| 404 | args.push_back(GetExePath(m_ArgV[0])); |
| 405 | |
| 406 | for (int i=1; i < Application::GetArgC(); i++) { |
| 407 | if (std::string(Application::GetArgV()[i]) != "--reload-internal") |
| 408 | args.push_back(Application::GetArgV()[i]); |
| 409 | else |
| 410 | i++; // the next parameter after --reload-internal is the pid, remove that too |
| 411 | } |
| 412 | |
| 413 | #ifndef _WIN32 |
| 414 | args.push_back("--reload-internal"); |
| 415 | args.push_back(Convert::ToString(Utility::GetPid())); |
| 416 | #else /* _WIN32 */ |
| 417 | args.push_back("--validate"); |
| 418 | #endif /* _WIN32 */ |
| 419 | |
| 420 | double reloadTimeout = Application::GetReloadTimeout(); |
| 421 | |
| 422 | Process::Ptr process = new Process(Process::PrepareCommand(new Array(std::move(args)))); |
| 423 | process->SetTimeout(reloadTimeout); |
| 424 | process->Run(&ReloadProcessCallback); |
| 425 | |
| 426 | Log(LogInformation, "Application") |
| 427 | << "Got reload command: Started new instance with PID '" |
| 428 | << (unsigned long)(process->GetPID()) << "' (timeout is " |
| 429 | << reloadTimeout << "s)."; |
| 430 | |
| 431 | return process->GetPID(); |
| 432 | } |
| 433 | |
| 434 | /** |
| 435 | * Signals the application to shut down during the next |
nothing calls this directly
no test coverage detected