You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(server): Add socket_name_factory and on_init callbacks
Add two new optional parameters to Server constructor:
- socket_name_factory: Callable[[], str]
Generates unique socket names for new servers. Used when socket_name
is not provided. Useful for creating multiple servers with unique names.
- on_init: Callable[[Server], None]
Callback that runs after server initialization. Useful for tracking
server instances and performing cleanup in tests.
The socket_name_factory is tried after socket_name, maintaining backward
compatibility while adding flexibility for dynamic socket name generation.
Example:
def socket_name_factory() -> str:
return f"tmux_{next(counter)}"
server = Server(socket_name_factory=socket_name_factory)
This enables better testing patterns and more flexible server creation,
particularly in test environments where unique socket names are needed.
0 commit comments