diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2021-06-02 20:57:21 +0200 |
---|---|---|
committer | Matthias Hecker <36882671+mattzque@users.noreply.github.com> | 2021-06-05 18:06:45 +0200 |
commit | 03d0839fa48fd9424b7a968986e96b7e69e84d25 (patch) | |
tree | 86e042cf3baf2ec54be17599a748123eafdc6ec8 /lib/rbot/ircbot.rb | |
parent | bfa60f1846df4cc8d1713c0143477fea791da87c (diff) |
logger: fix STDERR recursion
Overriding (as we should do) the standard error write method when
daemonizing introduces a recursion in the logger, due to the
persistent presence of the console logger.
The solution is obviously to stop logging on console
after daemonization.
Diffstat (limited to 'lib/rbot/ircbot.rb')
-rw-r--r-- | lib/rbot/ircbot.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index 91586c6a..817acd71 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -431,7 +431,10 @@ class Bot LoggerManager.instance.set_logfile(@logfile, @config['log.keep'], @config['log.max_size']) if $daemonize - log "Redirecting standard input/output/error" + log "Redirecting standard input/output/error, console logger disabled" + LoggerManager.instance.flush + LoggerManager.instance.disable_console_logger + [$stdin, $stdout, $stderr].each do |fd| begin fd.reopen "/dev/null" |