Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2737f70

Browse files
authored
Improve safety/robustness of config:pull so that it halts if the export did not report a destination path. (#4099)
1 parent 99923aa commit 2737f70

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Commands/config/ConfigPullCommands.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,15 @@ public function pull($source, $destination, $options = ['safe' => false, 'label'
5151
$this->logger()->notice(dt('Starting to export configuration on :destination.', [':destination' => $destination]));
5252
$process = $this->processManager()->drush($sourceRecord, 'config-export', [], $export_options + $global_options);
5353
$process->mustRun();
54-
// Trailing slash assures that we transfer files and not the containing dir.
55-
$export_path = $this->getConfig()->simulate() ? '/simulated/path' : trim($process->getOutput()) . '/';
54+
55+
if ($this->getConfig()->simulate()) {
56+
$export_path = '/simulated/path';
57+
} elseif (empty(trim($process->getOutput()))) {
58+
throw new \Exception(dt('The Drush config:export command did not report the path to the export directory.'));
59+
} else {
60+
// Trailing slash ensures that we transfer files and not the containing dir.
61+
$export_path = trim($process->getOutput()) . '/';
62+
}
5663

5764
if (strpos($destination, ':') === false) {
5865
$destination .= ':%config-' . $options['label'];

0 commit comments

Comments
 (0)