module Mixlib::ShellOut::Unix
def clean_parent_file_descriptors
number could be made to be configurable or updated based on
limit in a chef environment. If we have issues in the future this
descriptors upto 256. We believe this is a reasonable upper
NOTE: After some discussions we've decided to iterate on file
is killed.
coming from the parent to prevent unintended locking if parent
descriptors of the parent. We clean the file descriptors
When a new process is started with chef, it shares the file
def clean_parent_file_descriptors # Don't clean $stdin, $stdout, $stderr, process_status_pipe. 3.upto(256) do |n| # We are checking the fd for error pipe before attempting to # create a file because error pipe will auto close when we # try to create a file since it's set to CLOEXEC. if n != @process_status_pipe.last.to_i begin fd = File.for_fd(n) fd.close if fd rescue end end end end