From 99ab8cc93ca66e5cb1819e96856846e7a9230b3c Mon Sep 17 00:00:00 2001 From: Wiebe Verweij Date: Tue, 21 Jul 2020 12:54:38 +0200 Subject: [PATCH] Improve handling of missing output of virtualenv version fact command Partially fixes #527 Signed-off-by: Wiebe Verweij --- lib/facter/virtualenv_version.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/facter/virtualenv_version.rb b/lib/facter/virtualenv_version.rb index 5cf2e019..dbaba059 100644 --- a/lib/facter/virtualenv_version.rb +++ b/lib/facter/virtualenv_version.rb @@ -3,7 +3,8 @@ Facter.add('virtualenv_version') do setcode do if Facter::Util::Resolution.which('virtualenv') - Facter::Util::Resolution.exec('virtualenv --version 2>&1').match(%r{(\d+\.\d+\.?\d*).*$})[1] + results = Facter::Util::Resolution.exec('virtualenv --version 2>&1').match(%r{(\d+\.\d+\.?\d*).*$}) + results[1] if results end end end