From: Brian Candler Date: 2009-02-09T22:02:42+09:00 Subject: Re: assignment to $stdout deprecated? 7stud -- wrote: > AFAIK, all child processes receive a copy of their environment including > copies of all the variables in the parent. Starting a different child process, such as a shell, involves fork() followed by exec() in the child. Immediately after the fork(), the child will have a copy of everything the parent has, including the file descriptor table. It then has the opportunity (if it wishes) to clean up the FD table before calling exec(), and/or to pass a different environment or arguments to the program which it is exec()ing. > So echo doesn't write to > $stdout because echo doesn't understand ruby and therefore ignores > variables like $stdout? Basically, yes. echo just writes to FD 1. It doesn't know anything about Ruby or Ruby objects. Indeed since Ruby is running in a different process, it cannot possibly access them (other than via some sort of IPC, e.g. communicating over a pipe) Regards, Brian. -- Posted via http://www.ruby-forum.com/.