Skip to content

Abort with argument #2557

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

Merged
merged 1 commit into from
Jan 26, 2022
Merged

Abort with argument #2557

merged 1 commit into from
Jan 26, 2022

Conversation

arzezak
Copy link
Contributor

@arzezak arzezak commented Jan 12, 2022

It condenses two lines into one being that abort exits with 1.

Copy link
Member

@pirj pirj left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -28,8 +28,7 @@
begin
ActiveRecord::Migration.maintain_test_schema!
rescue ActiveRecord::PendingMigrationError => e
puts e.to_s.strip
exit 1
abort "#{e}".strip
Copy link
Member

Choose a reason for hiding this comment

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

There is a difference, though. abort outputs to STDERR, while puts to STDOUT.
I tend to think that STDERR is more appropriate here.

Cosmetic: I'd prefer to keep e.to_s. Is there a reason to use string interpolation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that STDERR seems to be more appropriate. No reason to use string interpolation. I'll go ahead and update the PR. Thank you very much.

It condenses two lines into one being that `abort` exits with 1.
@arzezak arzezak force-pushed the abort-with-message branch from 14d37d8 to 5acd27a Compare January 13, 2022 13:27
@pirj
Copy link
Member

pirj commented Jan 13, 2022

@JonRowe Do you have any objections on merging this small change?

@JonRowe
Copy link
Member

JonRowe commented Jan 14, 2022

I'm on the fence due to the change in stdout to stderr

@arzezak
Copy link
Contributor Author

arzezak commented Jan 14, 2022

It'd be the same approach as the one already taken on line 6.

abort("The Rails environment is running in production mode!") if Rails.env.production?

@pirj
Copy link
Member

pirj commented Jan 14, 2022

Would you wait a bit? We can merge this to the soon-to-be-released RSpec 4.

@JonRowe
Copy link
Member

JonRowe commented Jan 18, 2022

Having reviewed this further, I don't mind merging this as is, the intent of the original PR was to produce a better output for this error, and that it was to stdout probably didn't occur. @pirj I leave this decision up to you.

@JonRowe JonRowe merged commit d79d165 into rspec:main Jan 26, 2022
@arzezak arzezak deleted the abort-with-message branch January 17, 2023 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants