diff --git a/lib/facter/custom_facts/core/execution/base.rb b/lib/facter/custom_facts/core/execution/base.rb index 691637c597..b9e030b9ca 100644 --- a/lib/facter/custom_facts/core/execution/base.rb +++ b/lib/facter/custom_facts/core/execution/base.rb @@ -138,9 +138,9 @@ def log_stderr(msg, command, logger) logger.debug(format(STDERR_MESSAGE, command, msg.strip)) end - def builtin_command?(command) - output, _status = Open3.capture2("type #{command}") - output.chomp =~ /builtin/ ? true : false + # optional function to be defined in subclass if necessary + def builtin_command?(_command_) + nil end end end diff --git a/lib/facter/custom_facts/core/execution/posix.rb b/lib/facter/custom_facts/core/execution/posix.rb index 4208824d99..7f791b5bee 100644 --- a/lib/facter/custom_facts/core/execution/posix.rb +++ b/lib/facter/custom_facts/core/execution/posix.rb @@ -11,6 +11,11 @@ def search_paths ENV['PATH'].split(File::PATH_SEPARATOR) + DEFAULT_SEARCH_PATHS end + def builtin_command?(command) + output, _status = Open3.capture2("type #{command}") + output.chomp =~ /builtin/ ? true : false + end + def which(bin) if absolute_path?(bin) return bin if File.executable?(bin) && FileTest.file?(bin)