From: nobu.nokada@... Date: 2002-05-24T22:02:13+09:00 Subject: Re: OS independent scripts, system calls on Windows and Linux Hi, At Fri, 24 May 2002 21:26:54 +0900, Tobias Reif wrote: > Then I might think about an RCR for a feature which saves me from > writing stuff like > > [ http://ruby-talk.com/9739 ] > ... > if ENV.has_key?("OS") && ENV["OS"] =~ /nt/i > puts "It's either NT or 2K, use 'cmd.exe /c '" if $DEBUG > #it's either NT or Win2K > command_shell = "cmd.exe /c " > ... > > What do people think? Do you want to run internal commands of cmd.exe? It's definitely system dependent. For external commands, mingw32/mswin32 ruby runs a child process directly instead. > I'd like to have a way more platform independent system call > mechanism, in Ruby itself or in the std lib, which returns either nil, > an Error object of some sort, or a Stdout object of some kind, so I > can simply write something like > > commands = Commands.new ['this -x -y','that -a -b'] > commands.each do |cmd| > returned = cmd.issue # or ".run", ".enter", ... > case returned > when Stderr then raise returned > when Stdout then puts returned > end > end I'm not sure what you mean by Stderr and Stdout. Something other than streams? -- Nobu Nakada