From 47ccaac3269f3cea51a479f25818be7853368fd5 Mon Sep 17 00:00:00 2001 From: Kalindi Adhiya Date: Thu, 19 Feb 2026 11:54:30 +0530 Subject: [PATCH 1/3] handled silent filure for gzip commands --- src/Command/Pull/PullCommandBase.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Command/Pull/PullCommandBase.php b/src/Command/Pull/PullCommandBase.php index 68be46444..d98cfdaa5 100644 --- a/src/Command/Pull/PullCommandBase.php +++ b/src/Command/Pull/PullCommandBase.php @@ -486,10 +486,10 @@ private function importDatabaseDump(string $localDumpFilepath, string $dbHost, s 'mysql', ]); if ($this->localMachineHelper->commandExists('pv')) { - $command = 'pv "${:LOCAL_DUMP_FILEPATH}" --bytes --rate | gunzip | MYSQL_PWD="${:MYSQL_PASSWORD}" mysql --host="${:MYSQL_HOST}" --user="${:MYSQL_USER}" "${:MYSQL_DATABASE}"'; + $command = 'set -o pipefail; pv "${:LOCAL_DUMP_FILEPATH}" --bytes --rate | gunzip | MYSQL_PWD="${:MYSQL_PASSWORD}" mysql --host="${:MYSQL_HOST}" --user="${:MYSQL_USER}" "${:MYSQL_DATABASE}"'; } else { $this->io->warning('Install `pv` to see progress bar'); - $command = 'gunzip -c "${:LOCAL_DUMP_FILEPATH}" | MYSQL_PWD="${:MYSQL_PASSWORD}" mysql --host="${:MYSQL_HOST}" --user="${:MYSQL_USER}" "${:MYSQL_DATABASE}"'; + $command = 'set -o pipefail; gunzip -c "${:LOCAL_DUMP_FILEPATH}" | MYSQL_PWD="${:MYSQL_PASSWORD}" mysql --host="${:MYSQL_HOST}" --user="${:MYSQL_USER}" "${:MYSQL_DATABASE}"'; } $env = [ From 1adb5b2d67ca61b57b988c7446087bd87468af41 Mon Sep 17 00:00:00 2001 From: Kalindi Adhiya Date: Thu, 19 Feb 2026 12:17:13 +0530 Subject: [PATCH 2/3] corrected command in test --- tests/phpunit/src/Commands/Pull/PullCommandTestBase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php b/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php index 89739d341..1fe0d29cd 100644 --- a/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php +++ b/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php @@ -310,7 +310,7 @@ protected function mockExecuteMySqlImport( $this->mockExecutePvExists($localMachineHelper, $pvExists); $process = $this->mockProcess($success); $filePath = Path::join(sys_get_temp_dir(), "$env-$dbName-$dbMachineName-$createdAt.sql.gz"); - $command = $pvExists ? 'pv "${:LOCAL_DUMP_FILEPATH}" --bytes --rate | gunzip | MYSQL_PWD="${:MYSQL_PASSWORD}" mysql --host="${:MYSQL_HOST}" --user="${:MYSQL_USER}" "${:MYSQL_DATABASE}"' : 'gunzip -c "${:LOCAL_DUMP_FILEPATH}" | MYSQL_PWD="${:MYSQL_PASSWORD}" mysql --host="${:MYSQL_HOST}" --user="${:MYSQL_USER}" "${:MYSQL_DATABASE}"'; + $command = $pvExists ? 'set -o pipefail; pv "${:LOCAL_DUMP_FILEPATH}" --bytes --rate | gunzip | MYSQL_PWD="${:MYSQL_PASSWORD}" mysql --host="${:MYSQL_HOST}" --user="${:MYSQL_USER}" "${:MYSQL_DATABASE}"' : 'set -o pipefail; gunzip -c "${:LOCAL_DUMP_FILEPATH}" | MYSQL_PWD="${:MYSQL_PASSWORD}" mysql --host="${:MYSQL_HOST}" --user="${:MYSQL_USER}" "${:MYSQL_DATABASE}"'; $expectedEnv = [ 'LOCAL_DUMP_FILEPATH' => $filePath, 'MYSQL_DATABASE' => $localDbName, From 1a70c8703554a9741a78b3b650548f51743d6109 Mon Sep 17 00:00:00 2001 From: Kalindi Adhiya Date: Thu, 19 Feb 2026 14:03:58 +0530 Subject: [PATCH 3/3] occomodated co pilot suggestion --- src/Command/Pull/PullCommandBase.php | 4 ++-- tests/phpunit/src/Commands/Pull/PullCommandTestBase.php | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Command/Pull/PullCommandBase.php b/src/Command/Pull/PullCommandBase.php index d98cfdaa5..df78d43d2 100644 --- a/src/Command/Pull/PullCommandBase.php +++ b/src/Command/Pull/PullCommandBase.php @@ -486,10 +486,10 @@ private function importDatabaseDump(string $localDumpFilepath, string $dbHost, s 'mysql', ]); if ($this->localMachineHelper->commandExists('pv')) { - $command = 'set -o pipefail; pv "${:LOCAL_DUMP_FILEPATH}" --bytes --rate | gunzip | MYSQL_PWD="${:MYSQL_PASSWORD}" mysql --host="${:MYSQL_HOST}" --user="${:MYSQL_USER}" "${:MYSQL_DATABASE}"'; + $command = 'bash -c "set -o pipefail; pv \"${:LOCAL_DUMP_FILEPATH}\" --bytes --rate | gunzip | MYSQL_PWD=\"${:MYSQL_PASSWORD}\" mysql --host=\"${:MYSQL_HOST}\" --user=\"${:MYSQL_USER}\" \"${:MYSQL_DATABASE}\""'; } else { $this->io->warning('Install `pv` to see progress bar'); - $command = 'set -o pipefail; gunzip -c "${:LOCAL_DUMP_FILEPATH}" | MYSQL_PWD="${:MYSQL_PASSWORD}" mysql --host="${:MYSQL_HOST}" --user="${:MYSQL_USER}" "${:MYSQL_DATABASE}"'; + $command = 'bash -c "set -o pipefail; gunzip -c \"${:LOCAL_DUMP_FILEPATH}\" | MYSQL_PWD=\"${:MYSQL_PASSWORD}\" mysql --host=\"${:MYSQL_HOST}\" --user=\"${:MYSQL_USER}\" \"${:MYSQL_DATABASE}\""'; } $env = [ diff --git a/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php b/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php index 1fe0d29cd..512b57493 100644 --- a/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php +++ b/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php @@ -310,7 +310,9 @@ protected function mockExecuteMySqlImport( $this->mockExecutePvExists($localMachineHelper, $pvExists); $process = $this->mockProcess($success); $filePath = Path::join(sys_get_temp_dir(), "$env-$dbName-$dbMachineName-$createdAt.sql.gz"); - $command = $pvExists ? 'set -o pipefail; pv "${:LOCAL_DUMP_FILEPATH}" --bytes --rate | gunzip | MYSQL_PWD="${:MYSQL_PASSWORD}" mysql --host="${:MYSQL_HOST}" --user="${:MYSQL_USER}" "${:MYSQL_DATABASE}"' : 'set -o pipefail; gunzip -c "${:LOCAL_DUMP_FILEPATH}" | MYSQL_PWD="${:MYSQL_PASSWORD}" mysql --host="${:MYSQL_HOST}" --user="${:MYSQL_USER}" "${:MYSQL_DATABASE}"'; + $command = $pvExists + ? 'bash -c "set -o pipefail; pv \"${:LOCAL_DUMP_FILEPATH}\" --bytes --rate | gunzip | MYSQL_PWD=\"${:MYSQL_PASSWORD}\" mysql --host=\"${:MYSQL_HOST}\" --user=\"${:MYSQL_USER}\" \"${:MYSQL_DATABASE}\""' + : 'bash -c "set -o pipefail; gunzip -c \"${:LOCAL_DUMP_FILEPATH}\" | MYSQL_PWD=\"${:MYSQL_PASSWORD}\" mysql --host=\"${:MYSQL_HOST}\" --user=\"${:MYSQL_USER}\" \"${:MYSQL_DATABASE}\""'; $expectedEnv = [ 'LOCAL_DUMP_FILEPATH' => $filePath, 'MYSQL_DATABASE' => $localDbName,