From: Dennis Newbold Date: 2002-05-29T07:53:15+09:00 Subject: Re: OS independent scripts, system calls on Windows and Linux On Fri, 24 May 2002, Tobias Reif wrote: > Morris, Chris wrote: > > > > Seems maybe this is just a bug report: > > > Kinda. Perhaps more than one "bugreport", but still a potential RCR. The > problem may be which level of platform independence and ease of use / > convenience is seen as sufficient, and which OSes are sen as worthy to > be supported. > > Although I don't want to start tests because I don't have the stuff > required to compile a comprehensive list, here's what your examples did > here: > > > telnetted to > Welcome to SuSE Linux 8.0 (i386) - Kernel 2.4.18-64GB-SMP (3). > [...] > spe150> uname -a > Linux spe150 2.4.18-64GB-SMP #1 SMP Wed Mar 27 13:58:12 UTC 2002 i686 > unknown > spe150> ruby --version > ruby 1.6.7 (2002-03-01) [i686-linux] > spe150> ruby -e 'puts `date`' > Fri May 24 09:53:00 EDT 2002 > spe150> ruby -e "puts(system('date'))" > Fri May 24 10:04:54 EDT 2002 > true > > > WinME, PragProg Installer > > C:\>ruby --version > ruby 1.6.5 (2001-09-19) [i386-cygwin] > C:\>ruby -e 'puts `date`' > -e:1: command not found: date > C:\>date > Aktuelles Datum: Fr, 24.05.2002 > Neues Datum (TT.MM.JJ): > C:\>ruby -e "puts(system('date'))" > false > > > Tobi > > > -- > http://www.pinkjuice.com/ > It seems to me that your comparison results may be a little flawed because of an apples vs. oranges thing: 1. your Linux Ruby is 1.6.7, but your Windows ruby is 1.6.5 2. your Windows Ruby is the cygwin version, which is now somewhat dprecated due to know problems with cygwin. The recommended Rubies for a Windows platform would be either the mingw32 or mswin32 versions, although neither of these is perfect either. 3. "date" comes standard with all Linux distributions. It doesn't come standard with Windows, This may be the root cause of some of the error messages shown above. As a secondary note, if it turns out there is a real problem, and if it is fixed via an RCR, the fix will go into Ruby version 1.6.8 or something like that. This will require your Ruby scripts to check the Ruby version no. and do it one way on versions 1.6.7 and less (if it can be done at all on these versions), and a different way on Ruby 1.6.8 and above. (Unless you are the sysadmin on all platforms where your script will run, and you can build and install the newest Ruby on all of them, in which case the rest of this paragraph won't matter). This consideration leads me to suggest that perhaps a loadable extension which will do exactly what you want may be a cleaner way to get there. Just a thought. Dennis