Method: Foreman::Process#run

Defined in:
lib/foreman/process.rb

#run(options = {}) ⇒ Object

Run a Process

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :env (Object) — default: {}

    Environment variables to set for this execution

  • :output (Object) — default: $stdout

    The output stream



48
49
50
51
52
53
54
55
56
57
# File 'lib/foreman/process.rb', line 48

def run(options={})
  env    = @options[:env].merge(options[:env] || {})
  output = options[:output] || $stdout
  runner = "#{Foreman.runner}".shellescape
  pgroup = Foreman.windows? ? :new_pgroup : :pgroup

  Dir.chdir(cwd) do
    Process.spawn env, expanded_command(env), :out => output, :err => output, pgroup => true
  end
end