Method: CommandMapper::Command#command_string
- Defined in:
- lib/command_mapper/command.rb
permalink #command_string ⇒ String
Escapes any shell control-characters so that it can be ran in a shell.
717 718 719 720 721 722 723 724 725 726 727 728 729 |
# File 'lib/command_mapper/command.rb', line 717 def command_string escaped_command = Shellwords.shelljoin(command_argv) unless @command_env.empty? escaped_env = @command_env.map { |name,value| "#{Shellwords.shellescape(name)}=#{Shellwords.shellescape(value)}" }.join(' ') escaped_command = "#{escaped_env} #{escaped_command}" end return escaped_command end |