Skip to content

Commit f7423b6

Browse files
ekohlb4ldr
authored andcommitted
Safely handle a missing root user
In 657cd71 it was assumed that Etc would never be available on Windows and that the LoadError would catch it. Turns out that was an invalid assumption. This uses the safe operator to gracefully handle it. Fixes: 657cd71
1 parent a6b3e31 commit f7423b6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/facter/root_home.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
rescue LoadError
77
# Unavailable on platforms like Windows
88
else
9-
Etc.getpwnam('root').dir
9+
Etc.getpwnam('root')&.dir
1010
end
1111
end

0 commit comments

Comments
 (0)