From 2c87527d2d1607e2e2540f2e02859f14f481aa09 Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Fri, 19 Jul 2019 16:35:17 -0400 Subject: [PATCH] Forward the terminal size when running cli commands Currently the output from cli commands is matching the default in the docker container shell, but we should instead forward the values from the current terminal window. --- inc/composer/class-command.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/inc/composer/class-command.php b/inc/composer/class-command.php index 4c8d31c5..d221163e 100644 --- a/inc/composer/class-command.php +++ b/inc/composer/class-command.php @@ -189,13 +189,16 @@ protected function cli( InputInterface $input, OutputInterface $output ) { $option = $arg . '=' . escapeshellarg( substr( $option, strlen( $arg ) + 1 ) ); } } - + $columns = exec( 'tput cols' ); + $lines = exec( 'tput lines' ); $has_stdin = ! posix_isatty( STDIN ); $command = sprintf( - 'cd %s; VOLUME=%s COMPOSE_PROJECT_NAME=%s docker-compose exec %s -u nobody php wp %s', + 'cd %s; VOLUME=%s COMPOSE_PROJECT_NAME=%s docker-compose exec -e COLUMNS=%d -e LINES=%d %s -u nobody php wp %s', 'vendor/altis/local-server/docker', getcwd(), $this->get_project_subdomain(), + $columns, + $lines, $has_stdin || ! posix_isatty( STDOUT ) ? '-T' : '', // forward wp-cli's isPiped detection implode( ' ', $options ) );