From: Simon Strandgaard <0bz63fz3m1qt3001@...> Date: 2003-05-13T07:06:38+09:00 Subject: Re: RCR for child execution On Tue, 13 May 2003 04:17:56 +0900, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: RCR for child execution" > on 03/05/13, Brian Candler writes: > > |If you want a version of Ruby's "system" command which captures > |stderr/stdout into a string, you can write your own easily. I suggested > |the shorthand > | > | %X{command} > | > |to run a command and capture both stdout and stderr into a string (the RCR > |from which this thread gets its subject) > > I don't like this notation. But I like the idea of spawning child > with its stdin/out/err replaced. It should be something like > > system2(in, out, err, "command") > > but it needs better name. How about a System class instead ??? sys = System.new sys.command "ls" sys.arguments = ["existing", "non-existing"] sys.out my_stdout_handler sys.error my_stderr_handler sys.in my_stdin_handler sys.run Instead of getters/setters.. perhaps a Hash args = { "command" => "ls", "arguments" => ["existing", "non-existing"], "out" => my_stdout_handler, "error" => my_stderr_handler, "in" => my_stdin_handler, "prio" => "realtime" } sys = System.new(args) -- Simon Strandgaard