Skip to content

test: validate ANSI escape codes are not in redirected composer output#184

Merged
AaronFeledy merged 3 commits intomainfrom
test/ansi-escape-codes-157
Feb 28, 2026
Merged

test: validate ANSI escape codes are not in redirected composer output#184
AaronFeledy merged 3 commits intomainfrom
test/ansi-escape-codes-157

Conversation

@AaronFeledy
Copy link
Member

@AaronFeledy AaronFeledy commented Feb 27, 2026

Adds a test that verifies lando composer --version > file.txt does not contain ANSI escape codes in the output file.

This test is expected to FAIL on CI until the fix is applied — removing --ansi from the composer tooling command in builders/_drupaly.js.

The root cause is cmd: 'composer --ansi' which forces ANSI color codes even when stdout is redirected. Composer auto-detects TTY when --ansi isn't forced.

There's also a deeper issue in lando/core where docker exec allocates a TTY based on process.stdin.isTTY instead of process.stdout.isTTY (see lando/core#345), but removing --ansi is the first step.

Ref #157


Note

Low Risk
Low risk: changes a single tooling default (composer command) and adds a simple example verification to prevent ANSI escape codes in redirected output.

Overview
Stops forcing colored output for lando composer by removing the --ansi flag from the Drupal recipe tooling default, preventing escape codes when output is redirected.

Adds a verification command in the examples/drupal-defaults checks to assert redirected lando composer --version output contains no ANSI sequences, and documents the change in the CHANGELOG.

Written by Cursor Bugbot for commit da4df0e. This will update automatically on new commits. Configure here.

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
@netlify
Copy link

netlify bot commented Feb 27, 2026

Deploy Preview for lando-drupal ready!

Name Link
🔨 Latest commit da4df0e
🔍 Latest deploy log https://app.netlify.com/projects/lando-drupal/deploys/69a234936f0e9a00083e727e
😎 Deploy Preview https://deploy-preview-184--lando-drupal.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 82 (🔴 down 8 from production)
Accessibility: 96 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

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
@AaronFeledy AaronFeledy merged commit a326365 into main Feb 28, 2026
48 checks passed
@AaronFeledy AaronFeledy deleted the test/ansi-escape-codes-157 branch February 28, 2026 02:28
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.

1 participant