Resolve relay `emit` only when relaying
`supervise_run_process()` bound the relay `emit` method (`getattr(log, relay_level)`) unconditionally at entry, so a bad/typo'd `relay_level` raised `AttributeError` even for a call that requested NO relay (the common silent path). Bind it lazily behind `relay_stdout or relay_stderr` so only an actual relay request validates the level. Review: PR #465 (copilot-pull-request-reviewer) https://github.com/goodboy/tractor/pull/465#pullrequestreview-4548191641 (this patch was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-codewkt/start_or_cancel_tests_474
parent
e076296cda
commit
a3f8765264
|
|
@ -190,7 +190,14 @@ async def supervise_run_process(
|
|||
)
|
||||
|
||||
'''
|
||||
emit: Callable[[str], None] = getattr(log, relay_level)
|
||||
# resolve the relay emit-method ONLY when actually relaying so
|
||||
# a bad/typo'd `relay_level` can't crash a NON-relay call (and
|
||||
# we don't bind an unused method on the common silent path).
|
||||
emit: Callable[[str], None]|None = (
|
||||
getattr(log, relay_level)
|
||||
if (relay_stdout or relay_stderr)
|
||||
else None
|
||||
)
|
||||
tag: str = (
|
||||
label
|
||||
or
|
||||
|
|
|
|||
Loading…
Reference in New Issue