Check if fdshare module is enable on share_fds function

one_ring_to_rule_them_all
Guillermo Rodriguez 2025-04-13 14:02:09 -03:00
parent 73099fa1ba
commit 19ef8df9fd
No known key found for this signature in database
GPG Key ID: 002CC5F1E6BDA53E
1 changed files with 7 additions and 0 deletions

View File

@ -211,6 +211,13 @@ def share_fds(
Register a set of fds to be shared under a given name.
'''
this_actor = tractor.current_actor()
if __name__ not in this_actor.enable_modules:
raise RuntimeError(
f'Tried to share FDs {fds} with name {name}, but '
f'module {__name__} is not enabled in actor {this_actor.name}!'
)
maybe_fds = maybe_get_fds(name)
if maybe_fds:
raise RuntimeError(f'share FDs: {maybe_fds} already tied to name {name}')