Skip to content

Commit b41d7c6

Browse files
authored
Only assign to @filename if the path is valid. (#81)
1 parent 8915627 commit b41d7c6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/logger/log_device.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ def reopen(log = nil)
7979
def set_dev(log)
8080
if log.respond_to?(:write) and log.respond_to?(:close)
8181
@dev = log
82-
if log.respond_to?(:path)
83-
@filename = log.path
82+
if log.respond_to?(:path) and path = log.path
83+
if File.exist?(path)
84+
@filename = path
85+
end
8486
end
8587
else
8688
@dev = open_logfile(log)

0 commit comments

Comments
 (0)