$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [gsoc] Boost.Process done
From: Ilya Sokolov (ilyasokol_at_[hidden])
Date: 2010-08-31 09:47:38
On 20.08.2010 0:40, Boris Schaeling wrote:
> On Thu, 19 Aug 2010 22:34:36 +0200, Ilya Sokolov <ilyasokol_at_[hidden]>
> wrote:
>
>> Boris Schaeling wrote (in the attached file):
>> > File descriptors must be closed after context is instantiated as the
>> > context constructor uses the behavior inherit which tries to dup()
>> > stdin, stdout and stderr.
>>
>> Which makes me nervous (sorry) as it is superfluous in 90% of cases.
>
> Currently the standard constructor of the context class reproduces
> standard behavior on POSIX systems (file descriptors are inherited). Do
> you think this should be changed?
No, but read below.
> Or it would be fine to provide another
> constructor which expects up to three parameters to configure stdin,
> stdout and stderr?
I don't think it is good to create files in the constructors of classes
derived from stream_behavior. Consider the following program (untested):
bp::context ctx;
ctx.stdout_behaviour = bp::behavior::pipe::create(
bp::behavior::pipe::output_stream);
// 1
bp::child foo =
bp::create_child("foo", std::vector<std::string>(), ctx);
// 2
bp::child bar =
bp::create_child("bar", std::vector<std::string>(), ctx);
AFAIU, the line 2 will throw exception "dup2() failed" on POSIX, and
spawn child process with closed(!) stdout on Windows.