Sha256: 85dec7d6702c0fcd1ec149959c4f633823b72ed3f6e0208e50da82c3b202686d

Contents?: true

Size: 570 Bytes

Versions: 3

Compression:

Stored size: 570 Bytes

Contents

require "mixlib/shellout"

module Kurchatov
  module Mixin
    module Command

      def shell_out(cmd)
        mix = ::Mixlib::ShellOut.new(cmd)
        mix.run_command
        mix
      end

      def shell_out!(cmd)
        mix = shell_out(cmd)
        mix.error!
        mix
      end

      def shell(cmd)
        mix = shell_out!(cmd)
        mix.stdout
      end

      def print_unix_mem_info
        pid, size = `ps ax -o pid,rss | grep -E "^[[:space:]]*#{$$}"`.strip.split.map(&:to_i)
        puts "Pid: #{pid}, memusage: #{size}"
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kurchatov-0.0.2 lib/kurchatov/mixin/command.rb
kurchatov-0.0.2b lib/kurchatov/mixin/command.rb
kurchatov-0.0.1 lib/kurchatov/mixin/command.rb