Commit 578b75d

mo khan <mo.khan@gmail.com>
2020-03-12 22:34:03
Read content of file before switching directories
1 parent 01c558c
Changed files (1)
lib
spandx
rubygems
lib/spandx/rubygems/parsers/gemfile_lock.rb
@@ -24,9 +24,10 @@ module Spandx
         private
 
         def dependencies_from(filepath)
+          content = IO.read(filepath)
           Dir.chdir(File.dirname(filepath)) do
             ::Bundler::LockfileParser
-              .new(IO.read(filepath).sub(STRIP_BUNDLED_WITH, ''))
+              .new(content.sub(STRIP_BUNDLED_WITH, ''))
               .specs
           end
         end