-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
Use case :
- the command is invoked from a script (external symfony command for example), in non-interactive mode (interactive mode is not possible in this context)
phpstan.neonfile already exists
Was the command successful ? I think not, the new file was not copied/installed, we can't consider the init process is a success.
So in this case, command should return 1 or another code maybe 2, but not 0. (2 or more is best option I suppose).
Furthermore, there is another argument for arguing that the command should return 1.
Because of the non possible interaction, symfony has started to fill the errorOutput content, which means that symfony considers that an error happend. ($installPhpStanConfiguration->getErrorOutput() has content, see below).
Example :
$this->io->write("Installation of {$this->getScriptName()} configuration file : ", false);
$installPhpStanConfiguration = new Process(['php', 'vendor/bin/prestashop-coding-standards', 'phpstan:init', '--dest', getcwd()]);
$installPhpStanConfiguration->start();
$installPhpStanConfiguration->wait();
if (!$installPhpStanConfiguration->isSuccessful()) {
$this->io->error('failed !');
throw new RuntimeException("{$this->getPackageName()} configuration : {$installPhpStanConfiguration->getErrorOutput()}");
}
// The process is reported to successful even if the new file was not written :(
// fun fact : isSuccessuf() is true but getErrorOutput() has content
// at this point, we should parse the getErrorOutput() content to guess if an error happened.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels