CFINSPEC-92: Add be_running matcher for processes

Signed-off-by: Sonu Saha <sonu.saha@progress.com>
This commit is contained in:
Sonu Saha 2022-04-18 15:15:09 +05:30
parent b98a802be3
commit 93236e364f

View file

@ -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")