Skip to content

Commit 5b03b41

Browse files
author
Stanislav Idolov
authored
ENGCOM-773: Return status in console commands #13809
2 parents 07b7c14 + f90b6f0 commit 5b03b41

22 files changed

+36
-13
lines changed

setup/src/Magento/Setup/Console/Command/AbstractDependenciesCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
107107
// we must have an exit code higher than zero to indicate something was wrong
108108
return \Magento\Framework\Console\Cli::RETURN_FAILURE;
109109
}
110+
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
110111
}
111112
}

setup/src/Magento/Setup/Console/Command/AbstractMaintenanceCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9999
. '</info>'
100100
);
101101
}
102+
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
102103
}
103104

104105
/**

setup/src/Magento/Setup/Console/Command/AbstractModuleManageCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Symfony\Component\Console\Input\InputOption;
1313
use Magento\Framework\App\DeploymentConfig;
1414
use Magento\Framework\Module\Status;
15+
use Magento\Framework\Console\Cli;
1516

1617
abstract class AbstractModuleManageCommand extends AbstractModuleCommand
1718
{
@@ -77,14 +78,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
7778
if (!empty($messages)) {
7879
$output->writeln(implode(PHP_EOL, $messages));
7980
// we must have an exit code higher than zero to indicate something was wrong
80-
return \Magento\Framework\Console\Cli::RETURN_FAILURE;
81+
return Cli::RETURN_FAILURE;
8182
}
8283
try {
8384
$modulesToChange = $this->getStatus()->getModulesToChange($isEnable, $modules);
8485
} catch (\LogicException $e) {
8586
$output->writeln('<error>' . $e->getMessage() . '</error>');
8687
// we must have an exit code higher than zero to indicate something was wrong
87-
return \Magento\Framework\Console\Cli::RETURN_FAILURE;
88+
return Cli::RETURN_FAILURE;
8889
}
8990
if (!empty($modulesToChange)) {
9091
$force = $input->getOption(self::INPUT_KEY_FORCE);
@@ -96,7 +97,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9697
);
9798
$output->writeln('<error>' . implode("</error>\n<error>", $constraints) . '</error>');
9899
// we must have an exit code higher than zero to indicate something was wrong
99-
return \Magento\Framework\Console\Cli::RETURN_FAILURE;
100+
return Cli::RETURN_FAILURE;
100101
}
101102
}
102103
$this->setIsEnabled($isEnable, $modulesToChange, $output);
@@ -111,6 +112,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
111112
} else {
112113
$output->writeln('<info>No modules were changed.</info>');
113114
}
115+
return Cli::RETURN_SUCCESS;
114116
}
115117

116118
/**

setup/src/Magento/Setup/Console/Command/AdminUserCreateCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
159159
$output->writeln(
160160
'<info>Created Magento administrator user named ' . $input->getOption(AdminAccount::KEY_USER) . '</info>'
161161
);
162+
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
162163
}
163164

164165
/**

setup/src/Magento/Setup/Console/Command/ConfigSetCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ function ($value) {
126126
$output->writeln('<info>You made no changes to the configuration.</info>');
127127
}
128128
}
129+
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
129130
}
130131

131132
/**

setup/src/Magento/Setup/Console/Command/DbDataUpgradeCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
6767
}
6868
$installer = $this->installFactory->create(new ConsoleLogger($output));
6969
$installer->installDataFixtures();
70+
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
7071
}
7172
}

setup/src/Magento/Setup/Console/Command/DbSchemaUpgradeCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
8181
}
8282
$installer = $this->installFactory->create(new ConsoleLogger($output));
8383
$installer->installSchema($input->getOptions());
84-
return null;
84+
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
8585
}
8686
}

setup/src/Magento/Setup/Console/Command/DiCompileCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Magento\Setup\Module\Di\App\Task\OperationInterface;
2222
use Symfony\Component\Console\Command\Command;
2323
use Symfony\Component\Console\Helper\ProgressBar;
24+
use Magento\Framework\Console\Cli;
2425

2526
/**
2627
* Command to run compile in single-tenant mode
@@ -141,7 +142,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
141142
$output->writeln($line);
142143
}
143144
// we must have an exit code higher than zero to indicate something was wrong
144-
return \Magento\Framework\Console\Cli::RETURN_FAILURE;
145+
return Cli::RETURN_FAILURE;
145146
}
146147

147148
$modulePaths = $this->componentRegistrar->getPaths(ComponentRegistrar::MODULE);
@@ -211,8 +212,9 @@ function (OperationInterface $operation) use ($progressBar) {
211212
} catch (OperationException $e) {
212213
$output->writeln('<error>' . $e->getMessage() . '</error>');
213214
// we must have an exit code higher than zero to indicate something was wrong
214-
return \Magento\Framework\Console\Cli::RETURN_FAILURE;
215+
return Cli::RETURN_FAILURE;
215216
}
217+
return Cli::RETURN_SUCCESS;
216218
}
217219

218220
/**

setup/src/Magento/Setup/Console/Command/GenerateFixturesCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
133133
// we must have an exit code higher than zero to indicate something was wrong
134134
return \Magento\Framework\Console\Cli::RETURN_FAILURE;
135135
}
136+
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
136137
}
137138

138139
/**

setup/src/Magento/Setup/Console/Command/I18nCollectPhrasesCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
7777
$input->getOption(self::INPUT_KEY_MAGENTO)
7878
);
7979
$output->writeln('<info>Dictionary successfully processed.</info>');
80+
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
8081
}
8182
}

0 commit comments

Comments
 (0)