lib/beaker/command.rb in beaker-2.13.0 vs lib/beaker/command.rb in beaker-2.14.0
- old
+ new
@@ -48,10 +48,11 @@
@command = command
@options = options
@args = args
@environment = {}
@cmdexe = @options.delete(:cmdexe) || false
+ @prepend_cmds = @options.delete(:prepend_cmds) || nil
# this is deprecated and will not allow you to use a command line
# option of `--environment`, please use ENV instead.
[:ENV, :environment, 'environment', 'ENV'].each do |k|
if @options[k].is_a?(Hash)
@@ -63,18 +64,19 @@
# @param [Host] host An object that implements {Beaker::Host}'s
# interface.
# @param [String] cmd An command to call.
# @param [Hash] env An optional hash of environment variables to be used
+ # @param [String] pc An optional list of commands to prepend
#
# @return [String] This returns the fully formed command line invocation.
- def cmd_line host, cmd = @command, env = @environment
+ def cmd_line host, cmd = @command, env = @environment, pc = @prepend_cmds
env_string = env.nil? ? '' : environment_string_for( host, env )
cygwin = ((host['platform'] =~ /windows/) and host.is_cygwin? and @cmdexe) ? 'cmd.exe /c' : nil
# This will cause things like `puppet -t -v agent` which is maybe bad.
- [env_string, cygwin, cmd, options_string, args_string].compact.reject(&:empty?).join(' ')
+ [env_string, cygwin, pc, cmd, options_string, args_string].compact.reject(&:empty?).join(' ')
end
# @param [Hash] opts These are the options that the command takes
#
# @return [String] String of the options and flags for command.