Skip to content

Commit 822b386

Browse files
authored
Merge pull request #334 from ky3mr2/master
Update facter regex to work for Rust sudo variant (sudo-rs)
2 parents 0aae629 + 67a8162 commit 822b386

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/facter/sudoversion.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
setcode do
99
if Facter::Util::Resolution.which('sudo')
1010
sudoversion = Facter::Util::Resolution.exec('sudo -V 2>&1')
11-
%r{^Sudo version ([\w.]+)}.match(sudoversion)[1]
11+
match = %r{^(?:Sudo version|sudo-rs)\s+([\w.]+)}i.match(sudoversion)
12+
match[1] if match
1213
elsif Facter::Util::Resolution.which('rpm')
1314
Facter::Util::Resolution.exec('rpm -q sudo --qf \'%{VERSION}\'')
1415
elsif Facter::Util::Resolution.which('dpkg-query')

0 commit comments

Comments
 (0)