diff --git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in index 8adb57533a7a0baa422331e74aee4b9e32753246..6daf866acfccc5b840b2a1265c3d6a16ed5a6013 100755 --- a/extra/dist/tarantoolctl.in +++ b/extra/dist/tarantoolctl.in @@ -483,6 +483,16 @@ local function wrapper_cfg(cfg) os.exit(1) end + -- Prevent overwriting pid_file in subsequent box.cfg calls. + local box_cfg_mt = getmetatable(box.cfg) + local orig_cfg_call = box_cfg_mt.__call + box_cfg_mt.__call = function(old_cfg, new_cfg) + if old_cfg.pid_file ~= nil and new_cfg ~= nil and new_cfg.pid_file ~= nil then + new_cfg.pid_file = old_cfg.pid_file + end + orig_cfg_call(old_cfg, new_cfg) + end + return data end @@ -547,18 +557,6 @@ local function start() end os.exit(1) end - local box_cfg_mt = getmetatable(box.cfg) - if box_cfg_mt == nil then - log.error('box.cfg() is not called in an instance file') - os.exit(1) - end - local old_call = box_cfg_mt.__call - box_cfg_mt.__call = function(old_cfg, cfg) - if old_cfg.pid_file ~= nil and cfg ~= nil and cfg.pid_file ~= nil then - cfg.pid_file = old_cfg.pid_file - end - old_call(old_cfg, cfg) - end return 0 end