Sha256: 49dc86386746ff54da684598e08e032e1a58cca1df26a1bef4bae498bda4c340

Contents?: true

Size: 615 Bytes

Versions: 8

Compression:

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

8 entries across 8 versions & 1 rubygems

Version Path
serverspec-1.0.0 lib/serverspec/type/process.rb
serverspec-0.16.0 lib/serverspec/type/process.rb
serverspec-0.15.5 lib/serverspec/type/process.rb
serverspec-0.15.4 lib/serverspec/type/process.rb
serverspec-0.15.3 lib/serverspec/type/process.rb
serverspec-0.15.2 lib/serverspec/type/process.rb
serverspec-0.15.1 lib/serverspec/type/process.rb
serverspec-0.15.0 lib/serverspec/type/process.rb