Skip to content

Fix tput failures in CI/CD environments#34

Merged
lunarcloud merged 3 commits intomainfrom
copilot/fix-ci-cd-tput-issue
Feb 10, 2026
Merged

Fix tput failures in CI/CD environments#34
lunarcloud merged 3 commits intomainfrom
copilot/fix-ci-cd-tput-issue

Conversation

Copy link
Contributor

Copilot AI commented Feb 10, 2026

tput calls fail when TERM is unset or invalid (common in CI/CD), causing error output that breaks pipelines.

Changes

init.sh (color initialization)

  • Check tput availability before use
  • Suppress stderr on all tput invocations
  • Fall back to empty strings when unavailable

helpers.sh (terminal dimensions)

  • Fix command -v syntax to suppress stderr
  • Suppress stderr on tput lines/cols calls

CI/CD regression test (extras/test-ci-compatibility.sh)

  • Added automated test to prevent future regressions
  • Tests library sourcing with TERM=dumb, TERM unset, and normal terminal
  • Verifies no tput errors in output
  • Integrated into GitHub Actions workflow

Example

Before:

# Fails with: "tput: No value for $TERM and no -T specified"
ncolors=$(tput colors)

After:

if command -v tput >/dev/null 2>&1; then
  ncolors=$(tput colors 2>/dev/null)
else
  ncolors=""
fi

Library now sources cleanly in headless environments while maintaining color support when available. Automated CI tests ensure this compatibility is maintained going forward.

Original prompt

This section details on the original issue you should resolve

<issue_title>fails to run in CI/CD</issue_title>
<issue_description>A user ran a github action and there was an issue with running tput, which seems to stem from there being no tput command or maybe no actual terminal when running headless github action.

We should be able to use our fallback 'echo' solution in such an environment.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: lunarcloud <1565970+lunarcloud@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix CI/CD failure due to missing tput in headless environment Fix tput failures in CI/CD environments Feb 10, 2026
Copilot AI requested a review from lunarcloud February 10, 2026 16:16
@lunarcloud
Copy link
Owner

@copilot could you ensure the github action runs a small test to ensure we don't have future regressions in ci/cd compatibility?

Co-authored-by: lunarcloud <1565970+lunarcloud@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 10, 2026

@copilot could you ensure the github action runs a small test to ensure we don't have future regressions in ci/cd compatibility?

Added CI/CD compatibility test in commit 7749c0c. The test verifies the library sources correctly with TERM=dumb, TERM unset, and normal terminal settings. It runs automatically in GitHub Actions on every PR and push to master to catch any future regressions.

@lunarcloud lunarcloud marked this pull request as ready for review February 10, 2026 16:23
@lunarcloud lunarcloud merged commit 96e712d into main Feb 10, 2026
1 check passed
@lunarcloud lunarcloud deleted the copilot/fix-ci-cd-tput-issue branch February 10, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fails to run in CI/CD

2 participants