diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2022-12-08 16:28:13 +1300 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-12-08 03:28:18 +0000 |
commit | 7ab4820af7b39e12023ab3aee74cb7e66e97f786 (patch) | |
tree | 96c66d345eccd7b4156646dceca8cce0f445e7ac /lib/logger | |
parent | 2efaa80523054a50bbd21f079c5d4eb133053a60 (diff) |
[ruby/logger] Only assign to `@filename` if the path is valid.
(https://github.com/ruby/logger/pull/81)
https://github.com/ruby/logger/commit/b41d7c699c
Diffstat (limited to 'lib/logger')
-rw-r--r-- | lib/logger/log_device.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/logger/log_device.rb b/lib/logger/log_device.rb index 8683328a5e..84277a2656 100644 --- a/lib/logger/log_device.rb +++ b/lib/logger/log_device.rb @@ -79,8 +79,10 @@ class Logger def set_dev(log) if log.respond_to?(:write) and log.respond_to?(:close) @dev = log - if log.respond_to?(:path) - @filename = log.path + if log.respond_to?(:path) and path = log.path + if File.exist?(path) + @filename = path + end end else @dev = open_logfile(log) |