Method: Beaker::Command#cmd_line

Defined in:
lib/beaker/command.rb

#cmd_line(host, cmd = @command, env = @environment, pc = @prepend_cmds) ⇒ String

Returns This returns the fully formed command line invocation.



72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/beaker/command.rb', line 72

def cmd_line host, cmd = @command, env = @environment, pc = @prepend_cmds
  env_string = host.environment_string( env )
  prepend_commands = host.prepend_commands( cmd, pc, :cmd_exe => @cmdexe )
  if host[:platform] =~ /cisco/ && host[:user] != 'root'
      append_command = '"'
    cmd = cmd.gsub('"') { '\\"' }
  end

  # This will cause things like `puppet -t -v agent` which is maybe bad.
  cmd_line_array = [env_string, prepend_commands, cmd, options_string, args_string, append_command]
  cmd_line_array.compact.reject( &:empty? ).join( ' ' )
end