From: Sean O'Halpin Date: 2008-05-11T04:45:48+09:00 Subject: Re: How to tell if script running under rubyw vs ruby? On Sat, May 10, 2008 at 6:59 PM, Joe Swatosh wrote: > I spent some time poking around in Config, but so far this is the the > only thing I've found that works: > > begin > puts 'this is a test' > # here is ruby > rescue > # here is rubyw > end > > And I really don't love the side effect when using ruby. Please tell > me there is a better way. > > Thanks, > -- > Joe Swatosh > > As you've found out, stdout doesn't work under rubyw because all three usual streams (stdout, stdin and stderr) are closed in a Windows exe. I don't have a Window box handy to test, but you could try checking the value of STDOUT under rubyw - it's probably nil or something like that or you may get .eof? == true. Only a heuristic, but should serve to distinguish between your two use cases. Regards, Sean