On Sat, May 10, 2003 at 09:14:35AM +0100, Brian Candler wrote: > 1. A way to execute an external program capturing both stdout and stderr > into a string > > Syntax might be: %X{prog args} # capital X > > This differs from %x{prog args 2>&1} > > because it seems that Windows doesn't support the latter syntax. And also, the latter syntax doesn't capture any output generated on stderr by the shell itself - especially the common case where 'prog' does not exist. You just get an empty string returned and a message written on stderr. It would also be nice if Ruby could raise an exception when prog does not exist, instead of continuing blindly. Maybe it could exec the target program directly and *not* go via a shell, in cases where the shell is not needed (i.e. no pipes or redirection). But I can see how that would make things inconsistent between 'command pipelines' which use the shell, and 'single commands' which don't. Or it might be sufficient just to check for the appropriate exit status (127 in the case of /bin/sh and Unix). Otherwise you might end up having a simple shell in Ruby itself, just enough to do pipelines and redirection. The benefits would be proper exception handling and less dependencies on /bin/sh, but it doesn't really seem worth the maintenance effort. Regards, Brian.