Skip to content

fix: set TERM=screen for all non-interactive tmux calls - #4943

Closed
dgibbs64 wants to merge 1 commit into
developfrom
fix/tmux-term-screen
Closed

fix: set TERM=screen for all non-interactive tmux calls#4943
dgibbs64 wants to merge 1 commit into
developfrom
fix/tmux-term-screen

Conversation

@dgibbs64

Copy link
Copy Markdown
Member

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_status misreport a running server as STOPPED with 0% CPU/memory (the tmux query that gathers that info just fails).

Fix

Prefix TERM=screen on every non-interactive tmux invocation (status/query/send/start/stop). screen terminfo is essentially always present and these calls don't render an interactive UI, so the user's real terminal capabilities are irrelevant. The interactive console command is deliberately left untouched so it still inherits the user's terminfo.

Covers all non-interactive tmux -L invocations: check_status, command_send, command_start, command_stop, info_distro, update_xnt. (pgrep/pkill pattern strings, tmux -V version checks, and echoed strings are correctly not modified.)

Changes from the original #4860

  • Rebased cleanly onto current develop (resolved conflicts in command_stop.sh and update_xnt.sh, preserving develop's typo fix and exitbypass logic).
  • Fixed one prettier-plugin-sh nit in check_status.sh (2>/dev/null -> 2> /dev/null) so it doesn't trip the Prettier workflow.

Verification

  • prettier --check on all 6 files: clean.
  • bash -n on all 6 files: OK.

Fixes #4861

  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.
Copilot AI review requested due to automatic review settings July 19, 2026 18:39
@dgibbs64 dgibbs64 added this to the v26.2.0 milestone Jul 19, 2026
@github-actions github-actions Bot added command: console info: tmux type: bugfix Pull request that fixes a bug engine: unreal3 Issues related to unreal3 engine game: Xonotic Issues related to Xonotic labels Jul 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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=screen on non-interactive tmux -L ... calls used for status checks and session/pane queries.
  • Prefix TERM=screen on non-interactive tmux -L ... calls used to start/stop servers and send commands/keys.
  • Prefix TERM=screen on the Xonotic update module’s non-interactive tmux send-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.

@dgibbs64 dgibbs64 closed this Jul 19, 2026
@dgibbs64
dgibbs64 deleted the fix/tmux-term-screen branch July 19, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command: console engine: unreal3 Issues related to unreal3 engine game: Xonotic Issues related to Xonotic info: tmux type: bugfix Pull request that fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants