try to fix the case the *_ROOT dir is not in sys.path

This commit is contained in:
2025-08-29 11:20:35 +02:00
parent 94e8014a90
commit 83f04cf670
2 changed files with 11 additions and 7 deletions

View File

@@ -302,7 +302,10 @@ class ServiceManager:
if not ins:
raise UsageError('need instance')
env = self.env[ins]
return env.get('%s_ROOT' % gr, ''), env
startdir = env.get('%s_ROOT' % gr, '')
if startdir not in sys.path:
sys.path.insert(0, startdir)
return startdir, env
def do_start(self, ins, service=None, cfg='', restart=False, wait=False, logger=None, opts=''):
if not ins:
@@ -367,8 +370,6 @@ class ServiceManager:
start_dir, env = self.prepare_start(ins, service_i, cfg)
env = dict(os.environ, **env, Instrument=ins)
os.chdir(start_dir)
if start_dir not in sys.path:
sys.path.insert(0, start_dir)
nicosenv = '/home/nicos/nicos/nicosenv/bin/'
if exists(nicosenv):
env['PATH'] = f"{nicosenv}:{env['PATH']}"