Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Add fork_supported?. #342

Merged
merged 1 commit into from
Jan 27, 2018
Merged

Add fork_supported?. #342

merged 1 commit into from
Jan 27, 2018

Conversation

myronmarston
Copy link
Member

This is needed for the new fork-based bisect runner
in rspec/rspec-core#2511.

This is needed for the new fork-based bisect runner
in rspec/rspec-core#2511.
@myronmarston
Copy link
Member Author

Can I get a review of this, @rspec/rspec ? I tried to target the Gemfile in rspec/rspec-core#2511 at this branch so I can use this change there but it's not working for some reason. Merging this is the simplest path forward.

Copy link
Member

@JonRowe JonRowe left a comment

Choose a reason for hiding this comment

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

LGTM although I've a minor suggestion

false
end
else
def fork_supported?
Copy link
Member

Choose a reason for hiding this comment

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

Could we define this conditionally or memoized to avoid calling Process.respond_to?(:fork) repeatedly?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd want a benchmark showing memoization is faster as Process.respond_to?(:fork) isn't something I'd expect to be slow. Re: defining it conditionally...we could, but that's not an approach we're consistently following in this file. If we want to go that route, I think we should do it consistently throughout this file.

This method is only going to be called once per spec run (in RSpec::Core::Configuration#initialize) so it's definitely not a perf hot spot, anyway.

@myronmarston myronmarston merged commit 2f9091b into master Jan 27, 2018
@myronmarston myronmarston deleted the myron/fork-supported branch January 27, 2018 06:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants