Server._socket_args
Return this server's -S/-L flags, measuring the socket path.
Source and package
- Qualified name
-
libtmux.Server. _socket _args - Module
- libtmux
- Declared in
Server- Package
- libtmux
- Source
- src/libtmux/server.py
-
Description
Every path that spawns tmux for this server builds its argv from here, which is what makes the measurement total: a socket flag cannot reach tmux without having been measured on the way.
A tmux socket is a UNIX domain socket, so its path has to fit in
SOCKET_PATH_MAX_BYTES. An explicitsocket_pathis settled the moment it is passed and is measured in__init__; measuring it again here is free and keeps this method total over every flag it renders.A name or a bare server is different, and is measured only here, for the same reason
colorsis checked at this point: naming a server is not using one, sois_alive()has to stay answerable for a server that cannot be reached. It also readsTMUX_TMPDIRat the moment the tmux binary would read it, so an environment changed after construction is measured as tmux sees it rather than as it once was.- Returns
-
list[str]
["-S<path>"],["-L<name>"], or[]for a bare server, which leaves tmux to pick the socket itself --TMUXinside a pane, and a path underTMUX_TMPDIRoutside one. - Raises
-
-
Socket
Path – When the socket path -- given, or resolved fromToo Long socket_name-- cannot fit in a UNIX socket address.
-
Examples
>>> server._socket_args()['-Llibtmux_test...']>>> from libtmux.server import Server as TmuxServer>>> TmuxServer(socket_path="/tmp/short/sock")._socket_args()['-S/tmp/short/sock']A bare server names no socket, and tmux falls back to its own default:
>>> TmuxServer()._socket_args()[]A path too long to bind is refused here, before tmux is spawned:
>>> try:... TmuxServer(socket_path="/tmp/" + "d" * 120 + "/sock")._socket_args()... except exc.SocketPathTooLong as e:... print(e.length)130
Recorded calls
source callsThe Python reference records declarations, not calls, so this page shows no callers or callees. That is a limit of the extracted data, not a statement that nothing calls libtmux.Server._socket_args.