From: Charles D Hixson Date: 2001-09-23T03:48:59+09:00 Subject: [ruby-talk:21559] Re: Reassigning and reopening $stdin On Saturday 22 September 2001 11:22 am, you wrote: > Hi, > > In message "[ruby-talk:21553] Reassigning and reopening $stdin" > > on 01/09/23, Brian Marick writes: > |I know that $stdin.reopen("alternate-in") will work, but I > | cannot find a way to put $stdin back to its original value. So > | I don't see how you can temporarily redirect $stdin. Perhaps > | the answer is just "you shouldn't ever want to", which actually > | would be OK with me. > > You've find the hole. Sigh. That is a behavior that I couldn't > define properly. So $stdin assignment is not a final behavior. > If you have an opinion for what-it-should-be, I'm open. > > matz. Perhaps stdin, stdout, and stderr are important enough to have non-redefinable copies stored somewhere. This doesn't handle the problem of what to do about data that's in the buffer but hasn't been processed, but it makes it always possible to get back to where you can send and receive over the standard channels. A good choice for the names of these special copies seems to me to be: $STD_IN_ $STD_OUT_ $STD_ERR_ since they are global, constant, and special (i.e., they have no methods which allow them to set their values after creation [at program startup time]) -- Charles Hixson Copy software legally, the GNU way! Use GNU software, and legally make and share copies of software. See: http://www.gnu.org http://www.redhat.com http://www.linux-mandrake.com http://www.calderasystems.com http://www.linuxapps.com