summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-01-18 14:05:13 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2018-01-18 14:05:13 -0800
commit1417310f306571c90977cbe1c4e145d18f0f13d8 (patch)
tree116f2a0aa6c8ea877d0afb8a32f498d2d1cd6a39
parent805b26bba37356c1f62518c950e54ab610920a54 (diff)
downloadchef-1417310f306571c90977cbe1c4e145d18f0f13d8.tar.gz
fix double-logging buglcg/fix-double-logging
somehow we're getting an IO object here which is a STDOUT wired up to file descriptor 10 which is not the same as "STDOUT" which is wired up to file descriptor 1. i can't track down where or how this is happening. this works around the problem by just inspecting if the log_location is set to an IO object which is a tty or not which should be broadly equivalent (and perhaps more correct than the old code? not sure if the edge cases matter or not). also i'm not smart enough right now to figure out how to test this adequately, particularly in ways that would actually catch if it really breaks in the future (particularly due to the gnarliness of wanting to have a functional test which constructs a tty when run on travis without a tty....) Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/application.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/application.rb b/lib/chef/application.rb
index f5dced7702..b20766c8b5 100644
--- a/lib/chef/application.rb
+++ b/lib/chef/application.rb
@@ -1,7 +1,7 @@
#
# Author:: AJ Christensen (<aj@chef.io>)
# Author:: Mark Mzyk (mmzyk@chef.io)
-# Copyright:: Copyright 2008-2017, Chef Software Inc.
+# Copyright:: Copyright 2008-2018, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -177,7 +177,7 @@ class Chef
# Based on config and whether or not STDOUT is a tty, should we setup a
# secondary logger for stdout?
def want_additional_logger?
- ( Chef::Config[:log_location] != STDOUT ) && STDOUT.tty? && !Chef::Config[:daemonize]
+ !( Chef::Config[:log_location].is_a?(IO) && Chef::Config[:log_location].tty? ) && !Chef::Config[:daemonize]
end
def configure_stdout_logger