fix: set TERM=screen for all non-interactive tmux calls - #4943
Closed
dgibbs64 wants to merge 1 commit into
Closed
Conversation
When connected to a server via ssh, and the server doesn't have the
proper terminfo, tmux will fail with 'unsupported terminal' errors.
These errors are not surfaced by the scripts, e.g. details, start,
stop, so they result in either silent failures or don't work at all.
e.g. `./mcserver details` on my server showed 0% CPU, 0% Memory,
and STOPPED for the server status when the server was
actually running. This was because the tmux calls to get
this info failed.
The root cause of this was that I was connected to my server
via kitty, a terminal emulator that my server did not have
terminfo for.
This can be resolved via running `infocmp -x xterm-kitty | ssh
YOUR-SERVER -- tic -x -` and replacing `xterm-kitty` with whatever
is appropriate, or by setting TERM=xterm-256color in the ssh config,
but that is not obvious to do when presented with silent failures.
This commit sets TERM=screen for all non-interactive tmux calls,
which resolves the issue. Note that the `console` command does not
set this, as that is an interactive shell, and the user's terminfo
should be passed.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses silent failures of non-interactive tmux client calls when the SSH client’s $TERM references a terminfo entry not installed on the server (e.g., kitty/ghostty). By forcing TERM=screen for those non-interactive invocations, status/resource queries and command dispatch no longer misreport server state due to tmux failing with “unsupported terminal”.
Changes:
- Prefix
TERM=screenon non-interactivetmux -L ...calls used for status checks and session/pane queries. - Prefix
TERM=screenon non-interactivetmux -L ...calls used to start/stop servers and send commands/keys. - Prefix
TERM=screenon the Xonotic update module’s non-interactivetmuxsend-keys calls.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| lgsm/modules/check_status.sh | Forces TERM=screen for the tmux session-list used to determine server status. |
| lgsm/modules/command_send.sh | Forces TERM=screen for non-interactive tmux send-keys when dispatching console commands. |
| lgsm/modules/command_start.sh | Forces TERM=screen for non-interactive tmux session creation and pipe-pane console logging setup. |
| lgsm/modules/command_stop.sh | Forces TERM=screen for non-interactive tmux send/kill-session operations during shutdown. |
| lgsm/modules/info_distro.sh | Forces TERM=screen for non-interactive tmux session/pane PID discovery used in distro/resource reporting. |
| lgsm/modules/update_xnt.sh | Forces TERM=screen for non-interactive tmux send-keys used to query Xonotic version. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #4860 (rebased onto current develop; the original was CONFLICTING). Original author: @silasjmatson. Authorship preserved on the commit.
Problem
When connected to a server over SSH from a terminal whose terminfo the server lacks (e.g. kitty, ghostty), tmux fails with 'unsupported terminal' on non-interactive calls. These failures are silent, so commands like
details/check_statusmisreport a running server as STOPPED with 0% CPU/memory (the tmux query that gathers that info just fails).Fix
Prefix
TERM=screenon every non-interactive tmux invocation (status/query/send/start/stop).screenterminfo is essentially always present and these calls don't render an interactive UI, so the user's real terminal capabilities are irrelevant. The interactiveconsolecommand is deliberately left untouched so it still inherits the user's terminfo.Covers all non-interactive
tmux -Linvocations: check_status, command_send, command_start, command_stop, info_distro, update_xnt. (pgrep/pkill pattern strings,tmux -Vversion checks, and echoed strings are correctly not modified.)Changes from the original #4860
2>/dev/null->2> /dev/null) so it doesn't trip the Prettier workflow.Verification
prettier --checkon all 6 files: clean.bash -non all 6 files: OK.Fixes #4861