summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-03-12 16:34:03 -0600
committermo khan <mo.khan@gmail.com>2020-03-12 16:34:03 -0600
commit578b75dbb9b83ff9a924d2d27f9753421e504491 (patch)
tree2bed0e2ffd5a6c9531b1a8cab3712a081ed1fcbd
parent01c558c3809a584dccee42527ba0ddfd731e255d (diff)
Read content of file before switching directories
-rw-r--r--lib/spandx/rubygems/parsers/gemfile_lock.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/spandx/rubygems/parsers/gemfile_lock.rb b/lib/spandx/rubygems/parsers/gemfile_lock.rb
index 80fb2a4..5633fd5 100644
--- a/lib/spandx/rubygems/parsers/gemfile_lock.rb
+++ b/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