Method: ChildProcess.close_on_exec

Defined in:
lib/childprocess.rb

.close_on_exec(file) ⇒ Object

By default, a child process will inherit open file descriptors from the parent process. This helper provides a cross-platform way of making sure that doesn’t happen for the given file/io.



132
133
134
135
136
137
138
# File 'lib/childprocess.rb', line 132

def close_on_exec(file)
  if file.respond_to?(:close_on_exec=)
    file.close_on_exec = true
  else
    raise Error, "not sure how to set close-on-exec for #{file.inspect} on #{platform_name.inspect}"
  end
end