On Sat, May 10, 2003 at 06:45:36PM +0900, Simon Strandgaard wrote:
> In rubys source for "io.c" there is a bunch of WIN32 checks 
...
> The first 4 of them seems OK.. the rest of them is where I see 
> that windows requirs special attention. Windows is wierd.

It is, but Ruby has coded around those things, so you don't have to worry
about them. To me that's one of the big advantages of a high-level platform
like Ruby: one person solves the problem once and then your code works the
same.

Even bi-directional popen, which works in 1.6.8, was made to work for
Windows in 1.7.something.

> Further more I want to be able to run my favorite ruby-scripts unmodified.
> Example: rubyunit outputs to stdout/stderr.

Bad example, because they've thought of that already. If you run it from the
command line then yes it outputs to stdout/stderr, because you are invoking
the command-line runner; but it has many different runner interfaces. If you
run it using the GTk interface, then it outputs to GTk windows, and it also
has a FOX interface. Look in

/usr/local/lib/ruby/site_ruby/1.6/test/unit/ui

or the equivalent directory on your system.

In general, if I wanted to run some program which interacted over
stdin/stdout, but I wanted that interaction to occur inside a GUI window, I
would create a window, fork and exec a child, and talk to it over pipes, so
that I could capture keystrokes and send them down stdin, and capture stdout
and stick it on the screen as it was generated.

I'm pretty sure this is what happens when you run an xterm containing a
shell, for example.

> >   A. If you don't mind mixing the child's stdout and stderr, you might just
> >      get away with using shell redirection:
> >            string = `someprog args 2>&1`
> 
> This is the answer I have bumped into most-frequently on google.
> BTW: isn't this kind of redirection shell-specific (tcsh, zsh, ksh).

Yes. Ruby uses /bin/sh by default, so it's not unreasonable to assume
/bin/sh semantics. You might be able to configure it differently. But I
agree with you, I'd certainly be happier asking Ruby to dup fd1 and fd2 to
the same pipe, than using '2>&1'.

> Look at the "Exception Handling" section and tell me what you think:
> http://metaeditor.sf.net/embed/

Looks pretty good to me, I'm not a C++ programmer though so I can't comment
on the mapping between exceptions.

Cheers,

Brian.