From: Gennady Bystritsky Date: 2006-09-27T06:31:01+09:00 Subject: Re: forking processes and writing to log file Joe Van Dyk wrote: > On 9/26/06, Joe Van Dyk wrote: >> Hello, >> >> So, on linux, I'm forking a new Ruby process. I redirect stdout and >> stderr into a file and then I execute another program via 'system'. > > I should probably mention that the other program that's being executed > is rsh, which executes a command on a different machine. You either did not redirect stdout/stderr to a file properly, or something you execute tries to output directly to the controlling terminal (/dev/tty). You can disassosiate your spawned process from a controlling terminal, just to be sure (not with 'system' though): 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 === Gennady.