Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/chef-cli/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ def omnibus_env
end

def get_pkg_prefix(pkg_name)
path = `hab pkg path #{pkg_name} 2>/dev/null`.strip
stderr_redirect = Chef::Platform.windows? ? "2>NUL" : "2>/dev/null"
path = `hab pkg path #{pkg_name} #{stderr_redirect}`.strip
path if !path.empty? && Dir.exist?(path) # Return path only if it exists
end

Expand Down Expand Up @@ -265,7 +266,8 @@ def macos?
# @api private
#
def hab_pkg_installed?(pkg_name)
`hab pkg list #{pkg_name} 2>/dev/null`.include?(pkg_name) rescue false
stderr_redirect = Chef::Platform.windows? ? "2>NUL" : "2>/dev/null"
`hab pkg list #{pkg_name} #{stderr_redirect}`.include?(pkg_name) rescue false
end
end
end
Loading