Skip to content

Commit 0643d07

Browse files
committed
terminate with non-zero exit code when a secret could not be read
The fix for #42038 did a bit too much. Not only did it fix the PHP error that wasn't caught before, but also changed the exit code of the command. With this change the PHP error will still be prevented, but the command will terminate with a non-zero exit code to indicate the failure that occurred while reading the stored secrets.
1 parent beff62f commit 0643d07

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ CHANGELOG
88
* Derivate `kernel.secret` from the decryption secret when its env var is not defined
99
* Make the `config/` directory optional in `MicroKernelTrait`, add support for service arguments in the
1010
invokable Kernel class, and register `FrameworkBundle` by default when the `bundles.php` file is missing
11-
* Add `exit` option for `secrets:decrypt-to-local` command
11+
* [BC BREAK] The `secrets:decrypt-to-local` command terminates with a non-zero exit code when a secret could not be read
1212

1313
7.1
1414
---

Command/SecretsDecryptToLocalCommand.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public function __construct(
3838
protected function configure(): void
3939
{
4040
$this
41-
->addOption('exit', null, InputOption::VALUE_NONE, 'Returns a non-zero exit code if any errors are encountered')
4241
->addOption('force', 'f', InputOption::VALUE_NONE, 'Force overriding of secrets that already exist in the local vault')
4342
->setHelp(<<<'EOF'
4443
The <info>%command.name%</info> command decrypts all secrets and copies them in the local vault.
@@ -48,10 +47,6 @@ protected function configure(): void
4847
When the <info>--force</info> option is provided, secrets that already exist in the local vault are overridden.
4948
5049
<info>%command.full_name% --force</info>
51-
52-
When the <info>--exit</info> option is provided, the command will return a non-zero exit code if any errors are encountered.
53-
54-
<info>%command.full_name% --exit</info>
5550
EOF
5651
)
5752
;
@@ -100,7 +95,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
10095
$io->note($this->localVault->getLastMessage());
10196
}
10297

103-
if ($hadErrors && $input->getOption('exit')) {
98+
if ($hadErrors) {
10499
return 1;
105100
}
106101

0 commit comments

Comments
 (0)