Inherit parent process arguments for defined path constants

This commit is contained in:
Michael Friedrich 2018-09-27 20:05:25 +02:00
parent e545884952
commit e3e68caaa3
1 changed files with 14 additions and 5 deletions

View File

@ -394,15 +394,24 @@ void ApiListener::AsyncTryActivateZonesStage(const String& stageConfigDir, const
{
VERIFY(Application::GetArgC() >= 1);
// prepare arguments
/* Inherit parent process args. */
Array::Ptr args = new Array({
Application::GetExePath(Application::GetArgV()[0]),
"daemon",
"--validate",
"--define",
"System.ZonesStageVarDir='" + GetApiZonesStageDir() + "'" //Path is written onto the shell
});
for (int i = 1; i < Application::GetArgC(); i++) {
String argV = Application::GetArgV()[i];
if (argV == "-d" || argV == "--daemonize")
continue;
args->Add(argV);
}
args->Add("--validate");
args->Add("--define");
args->Add("System.ZonesStageVarDir='" + GetApiZonesStageDir() + "'");
Process::Ptr process = new Process(Process::PrepareCommand(args));
process->SetTimeout(300);
process->Run(std::bind(&TryActivateZonesStageCallback, _1, stageConfigDir, currentConfigDir, relativePaths, reload));