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

Infection must return appropriate exit status when failing #1299

Merged
merged 2 commits into from Aug 19, 2020

Conversation

sanmai
Copy link
Member

@sanmai sanmai commented Aug 19, 2020

This PR fixes the unfortunate issue where Infection wouldn't exit with an error status in case of an error (e.g. low MSI).

Tests pending.

Copy link
Member

@maks-rafalko maks-rafalko left a comment

Choose a reason for hiding this comment

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

can we target it to 0.17 branch?

@sanmai sanmai changed the base branch from master to 0.17 August 19, 2020 09:52
@sanmai
Copy link
Member Author

sanmai commented Aug 19, 2020

Sure!

@maks-rafalko
Copy link
Member

PHP Fatal error: Uncaught Error: Undefined class constant 'SUCCESS' in /home/travis/build/infection/infection/src/Command/BaseCommand.php:78

one job has failed with such error, restarted (I'm not sure why only one ;) )

@maks-rafalko
Copy link
Member

src/Command/BaseCommand.php Outdated Show resolved Hide resolved
@maks-rafalko maks-rafalko merged commit 31e4af4 into infection:0.17 Aug 19, 2020
@maks-rafalko
Copy link
Member

Thank you, @sanmai

@@ -213,7 +213,7 @@ protected function configure(): void
;
}

protected function executeCommand(IO $io): void
protected function executeCommand(IO $io): bool
Copy link
Member

Choose a reason for hiding this comment

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

how about keeping void here? In practice we tend to throw an exception in case of an error instead of a boolean value

Copy link
Member Author

@sanmai sanmai Aug 19, 2020

Choose a reason for hiding this comment

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

Do you propose that we re-throw the exceptions instead?

Copy link
Member

Choose a reason for hiding this comment

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

We actually already do since we don't wrap the whole call in with a catch (Throwable $t) (and Symfony already does it). So I don't think forcing this return code is providing anything tbh

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, we do wrap the other call for two very important exceptions.

@theofidry
Copy link
Member

theofidry commented Aug 19, 2020 via email

@sanmai
Copy link
Member Author

sanmai commented Aug 24, 2020

Well, not during CI. One expects that Infection will break the CI build if MSI is lower than required.

@sanmai sanmai deleted the pr/2020-08/fix-status branch August 24, 2020 13:47
@theofidry
Copy link
Member

Fair enough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants