lib/lambom/shell_mixin.rb in lambom-0.3.1 vs lib/lambom/shell_mixin.rb in lambom-0.3.5

- old
+ new

@@ -1,23 +1,34 @@ require 'mixlib/shellout' +require 'securerandom' module Lambom module ShellMixin + + DEFAULT_TIMEOUT = 12000 + def run_cmd(*cmd) + # Seteamos a 200min o timeout por defecto - opts = {} + opts = {:timeout => DEFAULT_TIMEOUT} if $debug puts "RUN_CMD: #{cmd}" - opts = {:live_stream => STDOUT} + 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 + + class String + def self.random(n) + SecureRandom.hex(n) + end end end end