Skip to content

Commit 3ecc9e4

Browse files
ENGCOM-1200: [Backport 2.1] Return status in console commands #14480
- Merge Pull Request #14480 from simpleadm/magento2:backport/2.1-console-commands-return-status - Merged commits: 1. 5de9601 2. 248073d
2 parents 2e9f1db + 248073d commit 3ecc9e4

22 files changed

+37
-12
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
@@ -66,6 +66,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6666
$output->writeln(
6767
'<info>Created Magento administrator user named ' . $input->getOption(AdminAccount::KEY_USER) . '</info>'
6868
);
69+
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
6970
}
7071

7172
/**

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 & 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->installSchema();
70+
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
7071
}
7172
}

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
@@ -127,7 +128,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
127128
$output->writeln($line);
128129
}
129130
// we must have an exit code higher than zero to indicate something was wrong
130-
return \Magento\Framework\Console\Cli::RETURN_FAILURE;
131+
return Cli::RETURN_FAILURE;
131132
}
132133

133134
$modulePaths = $this->componentRegistrar->getPaths(ComponentRegistrar::MODULE);
@@ -193,8 +194,9 @@ function (OperationInterface $operation) use ($progressBar) {
193194
} catch (OperationException $e) {
194195
$output->writeln('<error>' . $e->getMessage() . '</error>');
195196
// we must have an exit code higher than zero to indicate something was wrong
196-
return \Magento\Framework\Console\Cli::RETURN_FAILURE;
197+
return Cli::RETURN_FAILURE;
197198
}
199+
return Cli::RETURN_SUCCESS;
198200
}
199201

200202
/**

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

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

137138
/**

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)