lib/puppet/reports/wavefront.rb
# Examine the process table. Works for Solaris, FreeBSD, OpenBSD and
# Linux.
#
# @param pid [Integer] the process ID we are interested in
# @raise [String] UnknownOS if the OS is not recognized
# @return [Array] the command name of #pid and the parent PID
#
Examine the process table. Works for Solaris, FreeBSD, OpenBSD and
Linux.
Examine the process table . Works for Solaris FreeBSD OpenBSD and Linux .
def ps_cmd(pid)
  case RbConfig::CONFIG['arch']
  when /solaris|bsd/
    `ps -o comm,ppid -p #{pid}`
  when /linux/
    `ps -o cmd,ppid #{pid}`
  else
    raise 'UnknownOS'
  end.split("\n").last.split
end
def ps_cmd ( pid ) case RbConfig :: CONFIG [ 'arch' ] when / solaris|bsd / ` ps -o comm,ppid -p  #{ pid } ` when / linux / ` ps -o cmd,ppid  #{ pid } ` else raise 'UnknownOS' end . split ( "\n" ) . last . split end
Examine the process table.
Examine the process table .
the command name of #pid and the parent PID
the command name of #pid and the parent PID
Array
[String] UnknownOS if the OS is not recognized
[ String ] UnknownOS if the OS is not recognized
pid
the process ID we are interested in
the process ID we are interested in