diff options
author | dmitry kim <jason@nichego.net> | 2008-04-18 01:38:31 +0400 |
---|---|---|
committer | dmitry kim <jason@nichego.net> | 2008-04-18 01:38:31 +0400 |
commit | 96d13521d82d4fa4355faf9dd3b8aace86171c87 (patch) | |
tree | f101c13e312ed8aa5039a94ec9ec662c9eb13c08 /lib/rbot | |
parent | 049b3de3e37fddc0e119ada89edebde535f03549 (diff) |
* make the daemonization thing to suck less (wrt standard io channels)
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/ircbot.rb | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index 01b9d5b6..6a1c8f67 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -463,17 +463,20 @@ class Bot Dir.chdir botclass # File.umask 0000 # Ensure sensible umask. Adjust as needed. log "Redirecting standard input/output/error" - begin - STDIN.reopen "/dev/null" - rescue Errno::ENOENT - # On Windows, there's not such thing as /dev/null - STDIN.reopen "NUL" + [$stdin, $stdout, $stderr].each do |fd| + begin + fd.reopen "/dev/null" + rescue Errno::ENOENT + # On Windows, there's not such thing as /dev/null + fd.reopen "NUL" + end end - def STDOUT.write(str=nil) + + def $stdout.write(str=nil) log str, 2 return str.to_s.size end - def STDERR.write(str=nil) + def $stdout.write(str=nil) if str.to_s.match(/:\d+: warning:/) warning str, 2 else |