mirror of
https://github.com/inspec/inspec
synced 2024-11-15 01:17:08 +00:00
CFINSPEC-92: Add be_running matcher for processes
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
This commit is contained in:
parent
b98a802be3
commit
93236e364f
1 changed files with 9 additions and 0 deletions
|
@ -60,6 +60,15 @@ module Inspec::Resources
|
|||
@list
|
||||
end
|
||||
|
||||
# Matcher to check if the process is running
|
||||
def running?
|
||||
# Check if Regex needs to be tightened.
|
||||
# States value can be as:
|
||||
# for Unix: R, R< or R+
|
||||
# for Windows "True" or "False"
|
||||
states.any? and !!(states[0] =~ /True/ || states[0] =~ /^R+/)
|
||||
end
|
||||
|
||||
filter = FilterTable.create
|
||||
filter.register_column(:labels, field: "label")
|
||||
.register_column(:pids, field: "pid")
|
||||
|
|
Loading…
Reference in a new issue