better handling of keyboard interrupt on 'run'

+ add ServiceManager.get_cfg (works then also for FrappyManager)
This commit is contained in:
zolliker 2023-09-14 09:12:24 +02:00
parent 09a6d1cbbe
commit ac2ff53cb3

10
base.py
View File

@ -165,6 +165,11 @@ class ServiceManager:
example for sea: return samenv name
"""
cfginfo = {}
self.get_procs(self.group, cfginfo)
result = cfginfo.get((ins, service))
if result:
return result
return ''
def get_procs(self, groups=None, cfginfo=None):
@ -334,7 +339,12 @@ class ServiceManager:
sys.path.insert(0, start_dir)
if wait:
proc = subprocess.Popen(cmd.split(), env=env)
for _ in range(3):
try:
proc.wait()
break
except KeyboardInterrupt:
pass
return
process = subprocess.Popen(cmd.split(), env=env, start_new_session=True,
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)