Skip to content

Commit

Permalink
Move require closer to where it is used.
Browse files Browse the repository at this point in the history
This helps avoid a startup crash on Ruby 1.9.3 where the `rexml` gem
crashes when loaded due to syntax errors.

Fixes #1798, #1800, #1784
  • Loading branch information
jordansissel committed Nov 3, 2022
1 parent afc7c6f commit ac0ecdd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fpm/package/osxpkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
require "fpm/package/dir"
require 'tempfile' # stdlib
require 'pathname' # stdlib
require 'rexml/document' # stdlib

# Use an OS X pkg built with pkgbuild.
#
Expand Down Expand Up @@ -103,6 +102,7 @@ def pkginfo_template_path

# Extract name and version from PackageInfo XML
def extract_info(package)
require 'rexml/document'
build_path("expand").tap do |path|
doc = REXML::Document.new File.open(File.join(path, "PackageInfo"))
pkginfo_elem = doc.elements["pkg-info"]
Expand Down

0 comments on commit ac0ecdd

Please sign in to comment.