Skip to content

Commit

Permalink
Prevent Bootsnap::LoadPathCache::FallbackScan from polluting exceptio…
Browse files Browse the repository at this point in the history
…n cause
  • Loading branch information
aaronjensen committed Jul 31, 2020
1 parent 530fdb1 commit 7c5f386
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/bootsnap/load_path_cache/core_ext/kernel_require.rb
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

0 comments on commit 7c5f386

Please sign in to comment.