From: Brian Candler Date: 2003-05-14T18:31:57+09:00 Subject: Re: RCR for child execution On Wed, May 14, 2003 at 07:38:27AM +0900, Simon Strandgaard wrote: > On Wed, 14 May 2003 00:44:36 +0900, ts wrote: > > >>>>>> "S" == Simon Strandgaard <0bz63fz3m1qt3001@sneakemail.com> writes: > > > > I really don't understand what you want > > The refined description of what I want: a permanent sandbox > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/71364 Let me try to state your requirements more precisely, and you tell me if this is correct. You want to call the Ruby interpreter from C++, subject to the following conditions: 1. Absolutely *all* output generated on stdout/stderr as a side-effect of running the Ruby code is captured. 2. It is captured directly into a *string* in memory (i.e. capturing into a temporary file is forbidden) 3. It works for *all* possible Ruby programs (in particular we are including Ruby programs which call Kernel#exec or which call C libraries) 4. It must run as the *same* process as the C++ program (i.e. we are not allowed to do an additional fork for the purposes of capturing the output; any forks which would have been done anyway by the Ruby code as part of its normal operation are still allowed of course) Is that a correct description of the constraints of the problem? Please tell me, or please modify them. I have highlighted the key words. If so, I can demonstrate (prove?) that they are mutually exclusive, by reference to the Unix execution model: it's nothing to do with Ruby itself, and therefore cannot be changed by modifying Ruby. If you are happy to lift any one of those four constraints, I can give you a solution - one of those posted already. Regards, Brian.