Skip to content

Commit 4ddaadf

Browse files
Use format json instead of format string when fetching database credentials in sql:sync
1 parent 2b34f8a commit 4ddaadf

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ sut/*
1313
!sut/drush
1414
/sandbox/
1515
.env
16+
# Test fixtures
17+
sut/drush/sites/synctest.site.yml

src/Commands/sql/SqlSyncCommands.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,14 @@ public function databaseName(AliasRecord $record)
113113
return 'simulated_db';
114114
}
115115

116-
$process = $this->processManager()->drush($record, 'core-status', ['db-name'], ['format' => 'string']);
116+
$process = $this->processManager()->drush($record, 'core-status', ['db-name'], ['format' => 'json']);
117117
$process->setSimulated(false);
118118
$process->mustRun();
119-
return trim($process->getOutput());
119+
$data = $process->getOutputAsJson();
120+
if (!isset($data['db-name'])) {
121+
throw new \Exception('Could not look up database name for ' . $record->name());
122+
}
123+
return trim($data['db-name']);
120124
}
121125

122126
/**

sut/drush/sites/synctest.site.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)