Forking processes and writing to log file [CORRECTION]

Gennady Bystritsky wrote:

logfile = "my_log_file.log"
pid = fork do
  File.open(logfile, 'w') do |_io|
    $stdout.reopen(_io)
    $stderr.reopen(_io)
  end

  Process.setsess # In this scenario disassociates the controlling
                  # terminal until another tty device is open (will
                  # become new controlling tty).

  exec "the_command_line_used_to_be_launched_by_system"
end

Process.waitpid pid

Process.setsess should be Process.setsid. Sorry for confusion, clicked
on 'Send' too soon ;-).

···

===
Gennady.