Module: Redmine::Utils::Shell

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

Class Method Summary collapse

Class Method Details

.shell_quote(str) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/redmine/utils/shell.rb', line 25

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

.shell_quote_command(command) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/redmine/utils/shell.rb', line 33

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