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

Prevent FallbackScan from polluting exception cause #314

Merged
merged 1 commit into from
Aug 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions lib/bootsnap/load_path_cache/core_ext/kernel_require.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ def require(path)
rescue Bootsnap::LoadPathCache::ReturnFalse
false
rescue Bootsnap::LoadPathCache::FallbackScan
require_with_bootsnap_lfi(path)
fallback = true
ensure
if fallback
require_with_bootsnap_lfi(path)
end
end

alias_method(:require_relative_without_bootsnap, :require_relative)
Expand Down Expand Up @@ -67,7 +71,11 @@ def load(path, wrap = false)
rescue Bootsnap::LoadPathCache::ReturnFalse
false
rescue Bootsnap::LoadPathCache::FallbackScan
load_without_bootsnap(path, wrap)
fallback = true
ensure
if fallback
load_without_bootsnap(path, wrap)
end
end
end

Expand All @@ -88,6 +96,10 @@ def autoload(const, path)
rescue Bootsnap::LoadPathCache::ReturnFalse
false
rescue Bootsnap::LoadPathCache::FallbackScan
autoload_without_bootsnap(const, path)
fallback = true
ensure
if fallback
autoload_without_bootsnap(const, path)
end
end
end