module Mixlib::ShellOut::Unix

def configure_subprocess_file_descriptors

the new program will know it's never getting input ever.
If there is no input, close STDIN so when we exec,

reader side of the error marshaling side channel.
Replace stdout, and stderr with pipes to the parent, and close the
def configure_subprocess_file_descriptors
  process_status_pipe.first.close
  # HACK: for some reason, just STDIN.close isn't good enough when running
  # under ruby 1.9.2, so make it good enough:
  stdin_pipe.last.close
  STDIN.reopen stdin_pipe.first
  stdin_pipe.first.close unless input
  stdout_pipe.first.close
  STDOUT.reopen stdout_pipe.last
  stdout_pipe.last.close
  stderr_pipe.first.close
  STDERR.reopen stderr_pipe.last
  stderr_pipe.last.close
  STDOUT.sync = STDERR.sync = true
  STDIN.sync = true if input
end