Module: Lambom::ShellMixin

Included in:
Converger
Defined in:
lib/lambom/shell_mixin.rb

Defined Under Namespace

Classes: String

Constant Summary collapse

DEFAULT_TIMEOUT =
12000

Instance Method Summary collapse

Instance Method Details

#run_cmd(*cmd) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/lambom/shell_mixin.rb', line 9

def run_cmd(*cmd)
  # Seteamos a 200min o timeout por defecto

  opts = {:timeout => DEFAULT_TIMEOUT}

  if $debug
    puts "RUN_CMD: #{cmd}"
    opts[:live_stream] = STDOUT
  end

  com = Mixlib::ShellOut.new(cmd, opts)

  com.run_command
  com.error!

  puts "output: #{com.stdout}" if $debug
  com.stdout
end