From e3e68caaa36c9147ac4c4d1cc284cd5213efbd02 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 27 Sep 2018 20:05:25 +0200 Subject: [PATCH] Inherit parent process arguments for defined path constants --- lib/remote/apilistener-filesync.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/remote/apilistener-filesync.cpp b/lib/remote/apilistener-filesync.cpp index 8fe90ee43..87f1be475 100644 --- a/lib/remote/apilistener-filesync.cpp +++ b/lib/remote/apilistener-filesync.cpp @@ -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)); -- 2.40.0