test: validate ANSI escape codes are not in redirected composer output#184
Merged
AaronFeledy merged 3 commits intomainfrom Feb 28, 2026
Merged
test: validate ANSI escape codes are not in redirected composer output#184AaronFeledy merged 3 commits intomainfrom
AaronFeledy merged 3 commits intomainfrom
Conversation
Adds a test to verify that `lando composer` output does not contain ANSI escape codes when stdout is redirected to a file. This test is expected to FAIL until the fix is applied (removing `--ansi` from the composer tooling command). Ref #157
✅ Deploy Preview for lando-drupal ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Composer auto-detects TTY and enables color output when appropriate. The --ansi flag forced ANSI escape codes even when stdout was redirected to a file or used in command substitution, breaking scripted usage. Fixes #157
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.

Adds a test that verifies
lando composer --version > file.txtdoes not contain ANSI escape codes in the output file.This test is expected to FAIL on CI until the fix is applied — removing
--ansifrom the composer tooling command inbuilders/_drupaly.js.The root cause is
cmd: 'composer --ansi'which forces ANSI color codes even when stdout is redirected. Composer auto-detects TTY when--ansiisn't forced.There's also a deeper issue in lando/core where docker exec allocates a TTY based on
process.stdin.isTTYinstead ofprocess.stdout.isTTY(see lando/core#345), but removing--ansiis the first step.Ref #157
Note
Low Risk
Low risk: changes a single tooling default (
composercommand) and adds a simple example verification to prevent ANSI escape codes in redirected output.Overview
Stops forcing colored output for
lando composerby removing the--ansiflag from the Drupal recipe tooling default, preventing escape codes when output is redirected.Adds a verification command in the
examples/drupal-defaultschecks to assert redirectedlando composer --versionoutput contains no ANSI sequences, and documents the change in theCHANGELOG.Written by Cursor Bugbot for commit da4df0e. This will update automatically on new commits. Configure here.