diff options
Diffstat (limited to 'lib/mixlib/shellout')
-rw-r--r-- | lib/mixlib/shellout/unix.rb | 11 | ||||
-rw-r--r-- | lib/mixlib/shellout/windows.rb | 6 |
2 files changed, 9 insertions, 8 deletions
diff --git a/lib/mixlib/shellout/unix.rb b/lib/mixlib/shellout/unix.rb index bc0fc69..881d54a 100644 --- a/lib/mixlib/shellout/unix.rb +++ b/lib/mixlib/shellout/unix.rb @@ -1,4 +1,4 @@ -#-- +# # Author:: Daniel DeLeo (<dan@chef.io>) # Copyright:: Copyright (c) 2010-2016 Chef Software, Inc. # License:: Apache License, Version 2.0 @@ -284,7 +284,7 @@ module Mixlib end def read_stdout_to_buffer - while chunk = child_stdout.read_nonblock(READ_SIZE) + while ( chunk = child_stdout.read_nonblock(READ_SIZE) ) @stdout << chunk @live_stdout << chunk if @live_stdout end @@ -294,7 +294,7 @@ module Mixlib end def read_stderr_to_buffer - while chunk = child_stderr.read_nonblock(READ_SIZE) + while ( chunk = child_stderr.read_nonblock(READ_SIZE) ) @stderr << chunk @live_stderr << chunk if @live_stderr end @@ -304,7 +304,7 @@ module Mixlib end def read_process_status_to_buffer - while chunk = child_process_status.read_nonblock(READ_SIZE) + while ( chunk = child_process_status.read_nonblock(READ_SIZE) ) @process_status << chunk end rescue Errno::EAGAIN @@ -402,7 +402,8 @@ module Mixlib # Try to reap the child process but don't block if it isn't dead yet. def attempt_reap - if results = Process.waitpid2(@child_pid, Process::WNOHANG) + results = Process.waitpid2(@child_pid, Process::WNOHANG) + if results @reaped = true @status = results.last else diff --git a/lib/mixlib/shellout/windows.rb b/lib/mixlib/shellout/windows.rb index 226c7c4..5116d5f 100644 --- a/lib/mixlib/shellout/windows.rb +++ b/lib/mixlib/shellout/windows.rb @@ -1,4 +1,4 @@ -#-- +# # Author:: Daniel DeLeo (<dan@chef.io>) # Author:: John Keiser (<jkeiser@chef.io>) # Author:: Ho-Sheng Hsiao (<hosh@chef.io>) @@ -122,7 +122,7 @@ module Mixlib wmi = WmiLite::Wmi.new kill_process_tree(process.process_id, wmi, logger) Process.kill(:KILL, process.process_id) - rescue Errno::EIO, SystemCallError + rescue logger.warn("Failed to kill timed out process #{process.process_id}") if logger end @@ -357,7 +357,7 @@ module Mixlib ].join) end Process.kill(:KILL, instance.wmi_ole_object.processid) - rescue Errno::EIO, SystemCallError + rescue if logger logger.debug([ "Failed to kill child process #{child_pid}::", |