From: Tobias Reif Date: 2002-05-29T22:58:12+09:00 Subject: Re: OS independent scripts, system calls on Windows and Linux Nikodemus Siivola wrote: > Ruby can hardly be a true mindreader, although it sometimes seems so. > You want it to "know" that on Windows you want to pass you commands thru > cmd.exe -- but it cannot know that you don't actually want to use that > cygwin bash shell... It seems as if there might be possibilities for some sensible default behaviour (per default, use the "DOS prompt" on Windows, and sniff the cms.exe or command.com; stuff like http://ruby-talk.com/9739 ), with options to change the default behaviour. Anyways: > If you want to use ruby as a portable scripting tool, you > have to limit yourself to ruby-builtins (ie. File.delete "foo.txt") > for system manipulations, and to running portable programs: > not identical commands, but programs. OK, that would be sufficient for my current task. I have Java installed (put in in the system path) on Lin and Win; I can not call it from Ruby on WinME (last para in http://www.ruby-talk.com/41294 ). Could Ruby be improved in this regard (even if this issue is caused by highly quirky WinME internals?)(~: ask the DOS shell where the program (eg Java) is located)? > For checking program success it seems that you cannot trivially access > it's stderr on all platforms Perhaps there's room for improvement? For example... > (untill there is a portable open3.rb, at > least) This seems to be higly desirable; perhaps you want to write an RCR for that? I think we all want the same: better scripting across OSes. > system "program -lot -of -flags" || raise "program failed" is that the same as Nobu's system(*command) or exit 1 ? Tobi -- http://www.pinkjuice.com/