From: Tobias Reif Date: 2002-05-29T18:04:00+09:00 Subject: Re: OS independent scripts, system calls on Windows and Linux nobu.nokada@softhome.net wrote: Hi, > stdout/stderr are NOT exclusive. What would be returned when > both of stdout and stderr were outputted? I see; thank you very much for constructive criticism. Unfortunately I in no way have sufficient experience, skill, or knowledge to really help with the syntax, API, or implementation. I need the following: A very simple, (perhaps OO) way of writing batch/shell scripts in Ruby. I need to be able to rely on the fact that it will run on any of the major platforms. I want to get what the command returns; if possible, I'd like to know if there was any of stdout, stderr, or both, or nothing, so I can choose what to do with the returned strings/objetcs, or if to raise an error. Would that be feasible? Syntax *could* look like (this probably has errors) commands = Commands.new ['this -x -y','that -a -b'] commands.each do |cmd| returned = cmd.issue # or ".run", ".enter", ... # returned will hold a hash like # {}, or {:stderr=>'kabloom'}, or # {:stderr='minor error', :stdout=>'done.'} if returned[:stdout] puts returned[:stdout] elsif returned[:stderr] raise returned[:stderr] end # should be more OO: # the returned items are objects of class Stderr and ... # (something like that) # returned.inspect => [object_of_class_Stdout, object_of_class_...] end or ... if ret.stdout? puts retd.stdout.to_s elsif ret.error? raise ret.error.to_s end ... Tobi -- http://www.pinkjuice.com/