Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[config:import] return exit code on error (#3083) #3084

Merged
merged 2 commits into from
Jan 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Command/Config/ImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
if ($this->configImport($io, $storage_comparer)) {
$io->success($this->trans('commands.config.import.messages.imported'));
}
else {
return 1;
}
}


Expand All @@ -127,8 +130,9 @@ private function configImport(DrupalStyle $io, StorageComparer $storage_comparer
$io->success($this->trans('commands.config.import.messages.already-imported'));
} else {
try {
$config_importer->import();
$io->info($this->trans('commands.config.import.messages.importing'));
$config_importer->import();
return TRUE;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be return 0; ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The execute() function is expected to return an exit code (1 on failure, 0 or nothing on success), while the private configImport() function is expected to return a success boolean (TRUE on success, FALSE or nothing on failure). So it's weird, but consistent with the current usage...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, this is a private scope function. not the execute function.

} catch (ConfigImporterException $e) {
$message = 'The import failed due for the following reasons:' . "\n";
$message .= implode("\n", $config_importer->getErrors());
Expand Down