comparison libervia/backend/tools/common/async_process.py @ 4193:730f542e4ad0

core: add new `init_script_path` option: `init_script_path` option can be used in `[DEFAULTS]` to run a script at the end of backend initialisation. A new `init_pre_script` method is used to wait for backend to reach this stage (designed to be used mostly by CLI frontend), then the usual `ready_get` method is finished once the script is finished.
author Goffi <goffi@goffi.org>
date Wed, 13 Dec 2023 22:00:22 +0100
parents 4b842c1fb686
children
comparison
equal deleted inserted replaced
4192:1d24ff583794 4193:730f542e4ad0
131 else: 131 else:
132 command = cls.command 132 command = cls.command
133 cmd_args = [command] + args 133 cmd_args = [command] + args
134 if "env" not in kwargs: 134 if "env" not in kwargs:
135 # we pass parent environment by default 135 # we pass parent environment by default
136 kwargs["env"] = None 136 # FIXME: `None` doesn't seem to work, despite what documentation says, to be
137 # checked and reported upstream if confirmed.
138 kwargs["env"] = os.environ
137 reactor.spawnProcess(prot, 139 reactor.spawnProcess(prot,
138 command, 140 command,
139 cmd_args, 141 cmd_args,
140 **kwargs) 142 **kwargs)
141 return d 143 return d