Server.hasSession
Whether a session with this name exists.
Source and package
-
Description#
The name is matched exactly, including one holding "." or ":". tmux normally accepts a unique prefix as a session target, which would make checking
workanswer yes forworkspace; this method does not, and it lists every session and compares in JavaScript rather than asking tmux to resolve a target, since no target spelling is both exact and correct for a name holding a target separator. No server running on the socket answersfalse; any other failure to list sessions raises rather than being read as "no such session".Examples#
if (!(await server.hasSession("work"))) {await server.newSession({ name: "work" });}
tmux command#
The tmux commands behind hasSession.
tmux C API#
The C declarations in tmux that implement these commands.
In other ports#
Whether a session with this name exists
| Language | Equivalent |
|---|---|
| Python | libtmux |
| Rust | server |
| Go | tmux |
| Java | io |
| C# | Lib |
| C++ | no equivalent on Server |
| Swift | Server |
No equivalent is recorded in Ruby, Lua, PowerShell, Julia, Elixir, Kotlin, Scala or F#.