mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
prelaunch and post launch hooks are discovered and executed
This commit is contained in:
parent
17b0591587
commit
e545a6798a
1 changed files with 19 additions and 8 deletions
|
|
@ -968,20 +968,31 @@ class ApplicationLaunchContext:
|
|||
self.log.warning("Application was already launched.")
|
||||
return
|
||||
|
||||
# Discover launch hooks
|
||||
prelaunch_hooks, postlaunch_hooks = self.discover_launch_hooks()
|
||||
|
||||
# Execute prelaunch hooks
|
||||
for prelaunch_hook in prelaunch_hooks:
|
||||
prelaunch_hook.execute()
|
||||
|
||||
# Prepare subprocess args
|
||||
args = self.clear_launch_args(self.launch_args)
|
||||
self.log.debug(
|
||||
"Launching \"{}\" with args: {}".format(self.app_name, args)
|
||||
)
|
||||
# Run process
|
||||
self.process = subprocess.Popen(args, **self.kwargs)
|
||||
|
||||
# TODO do this with after-launch hooks
|
||||
try:
|
||||
self.after_launch_procedures()
|
||||
except Exception:
|
||||
self.log.warning(
|
||||
"After launch procedures were not successful.",
|
||||
exc_info=True
|
||||
)
|
||||
# Process post launch hooks
|
||||
for postlaunch_hook in postlaunch_hooks:
|
||||
try:
|
||||
postlaunch_hook.execute()
|
||||
|
||||
except Exception:
|
||||
self.log.warning(
|
||||
"After launch procedures were not successful.",
|
||||
exc_info=True
|
||||
)
|
||||
|
||||
return self.process
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue