Sha256: 9ae41058a47a38639890200a15375a1aee5d2e175290d6e0298a88f181bb4aa6

Contents?: true

Size: 619 Bytes

Versions: 2

Compression:

Stored size: 619 Bytes

Contents

module Serverspec
  module Type
    class Process < Base

      def running?
        pid = backend.run_command(commands.get_process(@name, :format => "pid="))[:stdout]
        not pid.empty?
      end

      def user
        get_column("user")
      end

      def group
        get_column("group")
      end

      def method_missing(meth)
        get_column(meth.to_s)
      end

      def get_column(keyword)
        ret = backend.run_command(commands.get_process(@name, :format => "#{keyword}="))
        val = ret[:stdout].strip
        val = val.to_i if val.match(/^\d+$/)
        val
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
serverspec-0.14.4 lib/serverspec/type/process.rb
serverspec-0.14.3 lib/serverspec/type/process.rb