[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: forking processes and writing to log file [CORRECTION]

Gennady Bystritsky

9/26/2006 9:37:00 PM

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.