pantheon-systems / terminus

The Pantheon CLI — a standalone utility for performing operations on the Pantheon Platform
https://pantheon.io
Other
318 stars 195 forks source link

WP-CLI commands no longer produce ASCII formatting #2322

Open SteveRyan-ASU opened 2 years ago

SteveRyan-ASU commented 2 years ago

Platform

[x] MacOS

Installed Via

[x] Composer

PHP Version

[X] 7.4x

Command Executed

terminus wp {site}.{env} -- plugin list terminus wp {site}.{env} -- theme list --format=table

Expected behavior

When running commands using WP-CLI, typically results are returned with the ASCII table formatting in tact. However, this format is now missing from all returned results. Specifying --format=table has no effect.

Actual behavior

With the -vvv option enabled:

tfserwin@EN4121062-EDO ~ % terminus wp 2019-engineering.live -vvv -- plugin list
 [info] #### REQUEST ####
Headers: {"User-Agent":"Terminus/3.0.4 (php_version=7.4.24&script=bin/terminus)","Accept":"application/json","Authorization":"**HIDDEN**"}
URI: https://terminus.pantheon.io:443/api/site-names/2019-engineering
Method: GET
Body: null
 [info] #### REQUEST ####
Headers: {"User-Agent":"Terminus/3.0.4 (php_version=7.4.24&script=bin/terminus)","Accept":"application/json","Authorization":"**HIDDEN**"}
URI: https://terminus.pantheon.io:443/api/sites/3a4c8eef-707c-45e9-8782-f4a67164c51e?site_state=true
Method: GET
Body: null
 [info] #### REQUEST ####
Headers: {"User-Agent":"Terminus/3.0.4 (php_version=7.4.24&script=bin/terminus)","Accept":"application/json","Authorization":"**HIDDEN**"}
URI: https://terminus.pantheon.io:443/api/site-names/2019-engineering
Method: GET
Body: null
 [info] #### REQUEST ####
Headers: {"User-Agent":"Terminus/3.0.4 (php_version=7.4.24&script=bin/terminus)","Accept":"application/json","Authorization":"**HIDDEN**"}
URI: https://terminus.pantheon.io:443/api/sites/3a4c8eef-707c-45e9-8782-f4a67164c51e/environments
Method: GET
Body: null
 [debug] shell command: wp plugin list
name    status  update  version
interactive-3d-flipbook-powered-physics-engine  active  available   1.9.10
tinymce-advanced    active  none    5.6.0
antispam-bee    active  none    2.10.0
aws-ses-wp-mail active  none    0.1.1
broken-link-checker active  none    1.11.16
classic-editor  active  none    1.6.2
accessible-divi active  none    1.2.5
elegant-themes-updater  inactive    none    1.0
enable-media-replace    active  none    3.6.3
google-sitemap-generator    inactive    none    4.1.1
gravityforms    active  none    2.5.16
gravityforms-styles-asu inactive    none    0.1.0
jetpack-unplugged   active  none    0.1
limit-login-attempts    active  none    1.7.1
monarch active  none    1.4.13
wp-native-php-sessions  active  none    1.2.4
pantheon-advanced-page-cache    active  none    1.0.0
pantheon-hud    inactive    none    0.3.1
post-types-order    active  available   1.9.5.7
public-post-preview active  none    2.9.3
post-expirator  inactive    available   2.7.1
redirection active  available   5.1.3
simple-page-ordering    inactive    none    2.3.4
stream  active  none    3.8.2
sugar-calendar  active  none    2.0.9
sc-calendar-feeds   inactive    none    1.0.3
tablepress  active  none    1.14
wordpress-importer  active  none    0.7
wp-optimize active  available   3.2.1
wp-migrate-db-pro   active  none    2.2.2
wp-migrate-db-pro-cli   inactive    none    1.6.0
wp-migrate-db-pro-media-files   active  none    2.1.0
wp-statistics   active  available   13.1.3
wordpress-seo   active  available   17.9
site-config-asudivi must-use    none    0.4
change-admin-outbound-email must-use    none    0.1
asudivi-additional-css  must-use    none    0.1
pantheon    must-use    none    0.1
wp-migrate-db-pro-compatibility must-use    none    1.1
 [notice] Command: 2019-engineering.live -- wp plugin list [Exit: 0]

Also tested with other sites using different themes/plugins, similar results. Also tested with other WP-CLI commands that produced formatted tables by default. Similar results.

SteveRyan-ASU commented 2 years ago

At the suggestion of @greg-1-anderson, I also downgraded Terminus to v.2.6.x all of the other v3.0.x releases individually and reran the same commands. Similar results, still an unformatted table.

From Slack another helpful comment from @greg-1-anderson:

... someone noted that table formatting did appear when running btool wp (a Pantheon internal tool that runs in a privileged mode). Btool runs with a tty, so I suspect that wp-cli 2.6.0 added tty detection, and downgrades the formatting when a tty is not present.

Nothing in the release notes from v2.6.0 immediately jumped out as "we changed a tty setting" but I'm pretty far out of my element here. LOL.

We also tracked down the following WP-CLI doc which suggested that there's a way to pass an environment variable to WP-CLI to ensure that results are formatted when passing them through a pipe.

That's all I got. 😁