Module: Redmine::Utils::Shell

Included in:
Scm::Adapters::AbstractAdapter, Thumbnail
Defined in:
lib/redmine/utils.rb

Class Method Summary collapse

Class Method Details

.shell_quote(str) ⇒ Object


73
74
75
76
77
78
79
# File 'lib/redmine/utils.rb', line 73

def shell_quote(str)
  if Redmine::Platform.mswin?
    '"' + str.gsub(/"/, '\\"') + '"'
  else
    "'" + str.gsub(/'/, "'\"'\"'") + "'"
  end
end

.shell_quote_command(command) ⇒ Object


81
82
83
84
85
86
87
# File 'lib/redmine/utils.rb', line 81

def shell_quote_command(command)
  if Redmine::Platform.mswin? && RUBY_PLATFORM == 'java'
    command
  else
    shell_quote(command)
  end
end