Repository navigation
feat(core): use plain line-based output when stdout is not a terminal - #5117
Merged
Merged
Conversation
Output captured by systemd/journald, cron, pipes or redirected files was full of colour codes, carriage returns and erase-line sequences, and in-place progress messages overwrote each other instead of producing complete lines. When stdout is not a terminal, LinuxGSM now omits all terminal control sequences. In-place status messages are held until they are replaced, completed by an end-of-line status or flushed, so each step is written as one complete line showing its final result. Held messages are flushed before headers, prompts and on exit. ansi="off" now consistently disables ANSI formatting: the erase-line sequence is no longer re-added unconditionally and text styles are only set when ANSI is enabled. Direct terminal control outside the shared helpers is also skipped in plain mode: the download progress bar, the dependency install spinner and tput cursor handling in fastdl and mods-remove.
This was referenced Nov 4, 2026
Merged
dgibbs64
added a commit
to GameServerManagers/LinuxGSM-Docs
that referenced
this pull request
Nov 8, 2026
Related to GameServerManagers/LinuxGSM#5117, released in v26.5.0. ## Changes - Explain the automatic plain output used for pipes and captured logs. - Document `ansi="off"` and the limits of the setting for game and SteamCMD output.
1 task
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.
Description
Output captured by systemd/journald, cron, containers, pipes or redirected files is hard to read: colour codes, carriage returns and erase-line sequences are written regardless of where stdout goes, and in-place progress messages overwrite each other instead of producing complete lines.
This PR adds a plain output mode, used automatically when stdout is not a terminal (
[ ! -t 1 ]). Interactive terminal output is unchanged.Plain mode (
core_messages.sh)fn_print_dots,fn_print_ok, etc.) are held instead of printed. A later status message replaces the held one, and an end-of-line status (fn_print_ok_eol_nl, etc.) completes it. The result is one complete line per step showing its final state, which is what the terminal ends up displaying.fn_print,fn_print_nl,fn_print_header,fn_prompt_ynandcore_exit.sh, so nothing is lost.fn_print_eol/fn_print_eol_nlhelpers.Before (piped,
cat -A):After:
ansi="off"fixfn_ansi_loaderunconditionally resetcreeolto include the erase-line sequence after the colour conditional, and always set the text style variables.ansi="off"now disables all ANSI formatting; on a terminal only the carriage return remains so progress lines still update in place. Also fixes an undefined${cree}in the non-commandactionbranch offn_print_message.Direct output outside the shared helpers
core_dl.sh: no curl progress bar in plain mode, and the "checking" line is written as a complete line instead of being erased.check_deps.sh: dependency install spinner skipped.command_fastdl.sh,command_mods_remove.sh:tput sc/rc/elcursor handling skipped; each fastdl step still ends with one summary line.Out of scope: structured output (JSON), passing
NO_COLOR/TERM=dumbthrough to the game server, thedev-detect-*developer commands, and SteamCMD progress output (#3655).Fixes #2484
Affected servers: all
Type of change
Testing
core_messages.shthat exercises dots/eol/replace sequences, raw output between messages, the restart countdown and a message left pending at exit, run through a pty (script), a pipe and a file redirect withansi="on"andansi="off".pmcservercontainer with this branch's modules:monitor,stop,startanddetailspiped and redirected to a file;monitorunder a pty withansi="on"andansi="off".shellcheckandshfmt -sr -ci -don all changed files.PIPESTATUS[0]= 0).ansi="on"byte-identical to the current release.ansi="off"contains no escape sequences.Risk and rollback
Breaking changes
Behaviour note: with
ansi="off"on a terminal, bold/italic/underline styling is now also disabled, not only colours. Scripts that parse captured output will see complete lines instead of carriage-return-joined fragments.Documentation
Checklist
PR will not be merged until all steps are complete.
Thank you for your Pull Request!