Sha256: a7aed58993ae8c3af04718e386e191cb095f798d40d0c542678953e1a6db0a71
Contents?: true
Size: 993 Bytes
Versions: 230
Compression:
Stored size: 993 Bytes
Contents
class Specinfra::Command::Windows::Base::Process < Specinfra::Command::Windows::Base class << self def check_process(process) Backend::PowerShell::Command.new do exec "(Get-Process '#{process}') -ne $null" end end def get(process, opts) column = opts[:format].chomp '=' case column when 'pid' # map 'pid' to its windows equivalent get_process_property(process, 'processid') when 'user' %Q!gwmi win32_process -filter "name = '#{process}'" | select -first 1 | %{$_.getowner().user}! when 'group' # no concept of process group on Windows raise NotImplementedError.new('Unable to get process group on Windows') else get_process_property(process, column) end end private def get_process_property(process, property) %Q!Get-WmiObject Win32_Process -Filter "name = '#{process}'" | select -First 1 #{property} -ExpandProperty #{property}! end end end
Version data entries
230 entries across 230 versions & 3 rubygems