Skip to content

Commit 99dfd2f

Browse files
authored
test: validate ANSI escape codes are not in redirected composer output (#134)
* test: add ANSI escape code validation for redirected composer output 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 lando/drupal#157 * fix: remove --ansi flag from composer tooling command 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. Ref lando/drupal#157 * docs: add CHANGELOG entry for --ansi removal --------- Co-authored-by: Aaron Feledy <aaron@aaronfeledy.com>
1 parent b274429 commit 99dfd2f

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})
22

33
* Updated to [@lando/nginx@1.6.0](https://github.com/lando/nginx/releases/tag/v1.6.0)
4+
* Removed `--ansi` flag from composer tooling command to prevent escape codes in redirected output
45

56
## v1.10.1 - [February 22, 2026](https://github.com/lando/wordpress/releases/tag/v1.10.1)
67

builders/wordpress.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const getDatabaseType = options => {
8888
const toolingDefaults = {
8989
'composer': {
9090
service: 'appserver',
91-
cmd: 'composer --ansi',
91+
cmd: 'composer',
9292
},
9393
'db-import <file>': {
9494
service: ':host',

examples/wordpress-defaults/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ lando mysql -u root -e "show variables;" | grep innodb_lock_wait_timeout | grep
5656

5757
# Should use composer 2 by default
5858
lando exec appserver -- /bin/sh -c 'NO_COLOR=1 composer -V' | grep "Composer version 2."
59+
60+
# Should not include ANSI escape codes when output is redirected
61+
lando composer --version > /tmp/composer-output.txt 2>&1 && ! grep -P '\x1b\[' /tmp/composer-output.txt
5962
```
6063

6164
## Destroy tests

0 commit comments

Comments
 (0)