From 1a3e37c25a3267850e11f2e2eb63a71679dc4130 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 10:50:52 +0000 Subject: [PATCH 1/2] Initial plan From 9a8ba27a111b1f95ebb535b8a243e1eae9ca57e5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 10:55:09 +0000 Subject: [PATCH 2/2] Fix progress bar going to new line on Windows Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- lib/cli/Shell.php | 8 ++++++-- lib/cli/progress/Bar.php | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/cli/Shell.php b/lib/cli/Shell.php index 037fe77..b9ae380 100755 --- a/lib/cli/Shell.php +++ b/lib/cli/Shell.php @@ -112,8 +112,12 @@ static public function hide($hidden = true) { * * @return bool */ - static private function is_windows() { - return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; + static public function is_windows() { + $test_is_windows = getenv( 'WP_CLI_TEST_IS_WINDOWS' ); + if ( false !== $test_is_windows ) { + return (bool) $test_is_windows; + } + return strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN'; } } diff --git a/lib/cli/progress/Bar.php b/lib/cli/progress/Bar.php index 43f21b5..9c58f76 100644 --- a/lib/cli/progress/Bar.php +++ b/lib/cli/progress/Bar.php @@ -82,6 +82,10 @@ public function display($finish = false) { $timing = Streams::render($this->_formatTiming, compact('elapsed', 'estimated', 'current', 'total', 'percent')); $size = Shell::columns(); + // On Windows, the cursor wraps to the next line if the output fills the entire width. + if ( Shell::is_windows() ) { + $size -= 1; + } $size -= strlen($msg . $timing); if ( $size < 0 ) { $size = 0;