Sha256: 47961ed113a72b229f4c836974f25aa3cd0305c39ca8ef8b500e6cf198697829

Contents?: true

Size: 707 Bytes

Versions: 4

Compression:

Stored size: 707 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

4 entries across 4 versions & 1 rubygems

Version Path
lambom-0.4.7 lib/lambom/shell_mixin.rb
lambom-0.4.3 lib/lambom/shell_mixin.rb
lambom-0.4.2 lib/lambom/shell_mixin.rb
lambom-0.3.5 lib/lambom/shell_mixin.rb