PHP 8.3.31
Preview: shellwords.rb Size: 856 B
/opt/cpanel/ea-ruby27/src/passenger-release-6.1.2/src/ruby_supportlib/phusion_passenger/utils/shellwords.rb

# Polyfill for the shellwords library on Ruby 1.8.5.

require 'shellwords'

if !Shellwords.respond_to?(:escape)
  Shellwords.class_eval do
    def self.escape(str)
      # An empty argument will be skipped, so return empty quotes.
      return "''" if str.empty?
      str = str.dup
      # Treat multibyte characters as is.  It is caller's responsibility
      # to encode the string in the right encoding for the shell
      # environment.
      str.gsub!(/([^A-Za-z0-9_\-.,:\/@\n])/, "\\\\\\1")
      # A LF cannot be escaped with a backslash because a backslash + LF
      # combo is regarded as line continuation and simply ignored.
      str.gsub!(/\n/, "'\n'")
      return str
    end
  end
end

if !Shellwords.respond_to?(:join)
  Shellwords.class_eval do
    def self.join(array)
      array.map { |arg| escape(arg) }.join(' ')
    end
  end
end

Directory Contents

Dirs: 0 × Files: 14

Name Size Perms Modified Actions
4.87 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
8.13 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
6.30 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
3.95 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
4.95 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
1.91 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
2.43 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
1.97 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
856 B lrw-r--r-- 2026-01-27 23:50:52
Edit Download
1.97 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
6.88 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
6.10 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
1.87 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
8.70 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).