summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatt Wrock <matt@mattwrock.com>2015-10-20 09:35:31 -0700
committerMatt Wrock <matt@mattwrock.com>2015-10-20 09:35:31 -0700
commit8e3a0d76591696420db87dab9019d295f15a3eb7 (patch)
treecbdcf1b0a389025382f9d67a291bc3eb2fdabca0 /lib
parent46d565c170eea893c95b5cb7d64378557938d309 (diff)
downloadmixlib-shellout-8e3a0d76591696420db87dab9019d295f15a3eb7.tar.gz
removing specialized logger and cleaning logging
Diffstat (limited to 'lib')
-rw-r--r--lib/mixlib/shellout/windows.rb26
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/mixlib/shellout/windows.rb b/lib/mixlib/shellout/windows.rb
index fe7fd19..5bca289 100644
--- a/lib/mixlib/shellout/windows.rb
+++ b/lib/mixlib/shellout/windows.rb
@@ -20,14 +20,8 @@
require 'win32/process'
require 'mixlib/shellout/windows/core_ext'
-require 'mixlib/log'
module Mixlib
- class ShelloutLog
- extend Mixlib::Log
- init("#{ENV['temp']}/shellout.txt")
- end
-
class ShellOut
module Windows
@@ -49,8 +43,6 @@ module Mixlib
# Missing lots of features from the UNIX version, such as
# uid, etc.
def run_command
- logger = ShelloutLog.logger
-
#
# Create pipes to capture stdout and stderr,
#
@@ -85,6 +77,7 @@ module Mixlib
#
# Start the process
#
+ logger.debug(Utils.format_process(process, app_name, command_line, timeout)) if logger
process = Process.create(create_process_args)
begin
# Start pushing data into input
@@ -97,7 +90,6 @@ module Mixlib
# Wait for the process to finish, consuming output as we go
#
start_wait = Time.now
- logger.warn(Utils.format_process(process, app_name, command_line, timeout)) if logger
while true
wait_status = WaitForSingleObject(process.process_handle, 0)
case wait_status
@@ -123,7 +115,11 @@ module Mixlib
logger.warn("Failed to kill timed out process #{process.process_id}") if logger
end
- raise Mixlib::ShellOut::CommandTimeout, "command timed out:\n#{format_for_exception}\n#{Utils.format_process(process, app_name, command_line, timeout)}"
+ raise Mixlib::ShellOut::CommandTimeout, [
+ "command timed out:",
+ format_for_exception,
+ Utils.format_process(process, app_name, command_line, timeout)
+ ].join("\n")
end
consume_output(open_streams, stdout_read, stderr_read)
@@ -330,10 +326,16 @@ module Mixlib
child_pid = instance.wmi_ole_object.processid
kill_process_tree(child_pid, wmi, logger)
begin
- logger.warn("killing child process #{child_pid}::#{instance.wmi_ole_object.Name} of parent #{pid}") if logger
+ logger.debug([
+ "killing child process #{child_pid}::",
+ "#{instance.wmi_ole_object.Name} of parent #{pid}"
+ ].join) if logger
Process.kill(:KILL, child_pid)
rescue Errno::EIO, SystemCallError
- logger.warn("Failed to kill child process #{child_pid}::#{instance.wmi_ole_object.Name} of parent #{pid}") if logger
+ logger.debug([
+ "Failed to kill child process #{child_pid}::",
+ "#{instance.wmi_ole_object.Name} of parent #{pid}"
+ ].join) if logger
end
end
end