Source at 4d73c9795adca3e49eea74d1d2cbbbbdcbea0b6c
SHA-256: a87e20080863153c687682f7c21961dd50edd853254dac38f8c09a1b34f03bbd
-module(inspect_demo). -moduledoc "Inspect an existing tmux socket without changing its sessions.". -export([run/2]). -spec run(binary(), binary()) -> map(). run(Socket, Executable) -> {ok, _} = application:ensure_all_started(libtmux_erlang), Endpoint = #{socket_path => Socket, executable => Executable}, {ok, Result} = tmux_server:with_server(Endpoint, fun(Server) -> {ok, Snapshot} = tmux_server:snapshot(Server), #{sessions => length(tmux_snapshot:sessions(Snapshot)), windows => length(tmux_snapshot:windows(Snapshot)), panes => length(tmux_snapshot:panes(Snapshot))} end), Result.