Sha256: 8128feaa55c4d6683f795f30cb5cab79555e83ccf498ace95bfc412592deb20e

Contents?: true

Size: 585 Bytes

Versions: 1

Compression:

Stored size: 585 Bytes

Contents

require 'mixlib/shellout'
require 'securerandom'

module Lambom
  module ShellMixin
    
    DEFAULT_TIMEOUT = 12000
    
    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

    class String
      def self.random(n)
        SecureRandom.hex(n)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lambom-0.4.8 lib/lambom/shell_mixin.rb