From 13b2ca2031147ed2af6689c4a896aec0156582a8 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Sat, 20 Jul 2019 22:59:00 -0700 Subject: Use Dir.glob(base: ...) to avoid chdir --- railties/lib/rails/paths.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'railties') diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb index 838fe55acc..0664338e0b 100644 --- a/railties/lib/rails/paths.rb +++ b/railties/lib/rails/paths.rb @@ -223,12 +223,10 @@ module Rails private def files_in(path) - Dir.chdir(path) do - files = Dir.glob(@glob) - files -= @exclude if @exclude - files.map! { |file| File.join(path, file) } - files.sort - end + files = Dir.glob(@glob, base: path) + files -= @exclude if @exclude + files.map! { |file| File.join(path, file) } + files.sort end end end -- cgit v1.2.3