Skip to content

Commit

Permalink
Lazily load shellwords library
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Jul 25, 2021
1 parent a75f579 commit e5532ef
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/rubygems/ext/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def self.run(command, results, command_name = nil, dir = Dir.pwd)
p(command)
end
results << "current directory: #{dir}"
require "shellwords"
results << command.shelljoin

require "open3"
Expand Down
3 changes: 1 addition & 2 deletions lib/rubygems/ext/ext_conf_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
# See LICENSE.txt for permissions.
#++

require 'shellwords'

class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil, extension_dir=Dir.pwd)
require 'fileutils'
Expand Down Expand Up @@ -40,6 +38,7 @@ def self.build(extension, dest_path, results, args=[], lib_dir=nil, extension_di
begin
# workaround for https://github.com/oracle/truffleruby/issues/2115
siteconf_path = RUBY_ENGINE == "truffleruby" ? siteconf.path.dup : siteconf.path
require "shellwords"
cmd = Gem.ruby.shellsplit << "-I" << File.expand_path("../../..", __FILE__) <<
"-r" << get_relative_path(siteconf_path, extension_dir) << File.basename(extension)
cmd.push(*args)
Expand Down
3 changes: 1 addition & 2 deletions lib/rubygems/ext/rake_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
# See LICENSE.txt for permissions.
#++

require "shellwords"

class Gem::Ext::RakeBuilder < Gem::Ext::Builder
def self.build(extension, dest_path, results, args=[], lib_dir=nil, extension_dir=Dir.pwd)
if File.basename(extension) =~ /mkrf_conf/i
Expand All @@ -16,6 +14,7 @@ def self.build(extension, dest_path, results, args=[], lib_dir=nil, extension_di
rake = ENV['rake']

if rake
require "shellwords"
rake = rake.shellsplit
else
begin
Expand Down

0 comments on commit e5532ef

Please sign in to comment.