Skip to content

Commit 21feae0

Browse files
committed
Make sure the file path is readable when it's ~/
1 parent 345e171 commit 21feae0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/post/osx/gather/safari_lastsession.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def get_safari_version
4141
version = ''
4242

4343
f = read_file("/Applications/Safari.app/Contents/version.plist")
44-
xml = REXML::Document.new(f)
44+
xml = REXML::Document.new(f) rescue nil
4545
return version if xml.root.nil?
4646

4747
xml.elements['plist/dict'].each_element do |e|
@@ -66,7 +66,7 @@ def peer
6666
#
6767
def plutil(filename)
6868
cmd_exec("plutil -convert xml1 #{filename}")
69-
read_file(filename)
69+
cmd_exec("cat #{filename}")
7070
end
7171

7272

@@ -88,7 +88,7 @@ def get_lastsession
8888
def get_sessions(lastsession)
8989
session_dict = nil
9090

91-
xml = REXML::Document.new(lastsession)
91+
xml = REXML::Document.new(lastsession) rescue nil
9292
return nil if xml.root.nil?
9393

9494
xml.elements['plist'].each_element do |e|

0 commit comments

Comments
 (0)