Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65538 - sandbox/SOC/2010/process/libs/process/test
From: boris_at_[hidden]
Date: 2010-09-22 17:13:01


Author: bschaeling
Date: 2010-09-22 17:13:00 EDT (Wed, 22 Sep 2010)
New Revision: 65538
URL: http://svn.boost.org/trac/boost/changeset/65538

Log:
Simplified test case for redirecting
Text files modified:
   sandbox/SOC/2010/process/libs/process/test/child.cpp | 25 ++++++++++++++++---------
   1 files changed, 16 insertions(+), 9 deletions(-)

Modified: sandbox/SOC/2010/process/libs/process/test/child.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/test/child.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/test/child.cpp 2010-09-22 17:13:00 EDT (Wed, 22 Sep 2010)
@@ -236,15 +236,22 @@
 #endif
 }
 
-bp::stream_ends redirect_to(bp::handle h)
+class redirect_to
 {
-#if defined(BOOST_WINDOWS_API)
- if (!SetHandleInformation(h.native(), HANDLE_FLAG_INHERIT,
- HANDLE_FLAG_INHERIT))
- BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("SetHandleInformation() failed");
-#endif
- return bp::stream_ends(h, bp::handle());
-}
+public:
+ redirect_to(bp::handle h)
+ : h_(h)
+ {
+ }
+
+ bp::stream_ends operator()(bp::stream_type) const
+ {
+ return bp::stream_ends(h_, bp::handle());
+ }
+
+private:
+ bp::handle h_;
+};
 
 bp::stream_ends forward(bp::stream_ends ends)
 {
@@ -261,7 +268,7 @@
 
     bp::context ctx;
     ctx.streams[bp::stdout_id] = boost::bind(forward, ends);
- ctx.streams[bp::stderr_id] = boost::bind(redirect_to, ends.child);
+ ctx.streams[bp::stderr_id] = redirect_to(ends.child);
 
     bp::child c = bp::create_child(get_helpers_path(), args, ctx);
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk