On Tue, 13 May 2003 04:04:23 +0900, Yukihiro Matsumoto wrote:

> Hi,
> 
> In message "Re: RCR for child execution"
> 
> |Separation of ruby stdout/stderr from C/C++ stdout/stderr is what I want.
> |I run Ruby in the same thread as C++ (ruby embedded into C++).
> |This separation is working fine, as long as I don't use system or
> |backquote.
> 
> Hmm, but still stdin is stdin.  The redirectable output port is
> $defout and $deferr (which is just added).
> 
> |Using system or backquote, then it goes BOOM. The problem as I see it is
> |localized in Rubys code - not mine!  Ruby spawns a child which inherits
> |stdout/stderr.  This child should instead inherit rb_stdout/rb_stderr
> |instead!!!    Can this issue be fixed on Ruby ???
> 
> I'm not sure what you meant by "BOOM".  Even when Ruby is embedded in
> the program, it's still in the same process.  The spawned process
> inherits stdin etc. from the parent process, even when it's created
> from within Ruby.  It's UNIX way.  I can't change it.  The only way I
> can think of to avoid "BOOM" is (if I understand correctly) to remove
> "system", "exec" and "`" methods.

OK.. I'll try explain what BOOM means :-)

BOOM = system+backquote outputs to stdout/stderr,  interfering with the
output of the C/C++ application.

This interference is what to avoid. I want to be able to
redirect Rubys output elsewhere: logfile/statusbox/text-buffer.

At the same time I want to use normal ruby code (system, backquote...).

Its has been suggested that I instead of system/backquote, uses popen.
But I don't consider it to be *normal* ruby code!



The problem is fairly simple, but I doubt anyone understands me ???

--
Simon Strandgaard