Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68668 - in sandbox/SOC/2010/process: boost/process libs/process/test
From: boris_at_[hidden]
Date: 2011-02-06 10:14:11


Author: bschaeling
Date: 2011-02-06 10:14:10 EST (Sun, 06 Feb 2011)
New Revision: 68668
URL: http://svn.boost.org/trac/boost/changeset/68668

Log:
Adapted library and test case for Windows 7
Fixed create_child() implementation for Cygwin
Text files modified:
   sandbox/SOC/2010/process/boost/process/operations.hpp | 8 ++++++++
   sandbox/SOC/2010/process/boost/process/stream_behavior.hpp | 21 ++++++++++++++++-----
   sandbox/SOC/2010/process/libs/process/test/context.cpp | 2 +-
   3 files changed, 25 insertions(+), 6 deletions(-)

Modified: sandbox/SOC/2010/process/boost/process/operations.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/operations.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/operations.hpp 2011-02-06 10:14:10 EST (Sun, 06 Feb 2011)
@@ -327,10 +327,18 @@
         detail::collection_to_windows_cmdline(args);
 
     boost::scoped_array<char> exe(new char[executable.size() + 1]);
+#if (BOOST_MSVC >= 1400)
     strcpy_s(exe.get(), executable.size() + 1, executable.c_str());
+#else
+ strcpy(exe.get(), executable.c_str());
+#endif
 
     boost::scoped_array<char> workdir(new char[ctx.work_dir.size() + 1]);
+#if (BOOST_MSVC >= 1400)
     strcpy_s(workdir.get(), ctx.work_dir.size() + 1, ctx.work_dir.c_str());
+#else
+ strcpy_s(workdir.get(), ctx.work_dir.c_str());
+#endif
 
     boost::shared_array<char> envstrs =
         detail::environment_to_windows_strings(ctx.env);

Modified: sandbox/SOC/2010/process/boost/process/stream_behavior.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/stream_behavior.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/stream_behavior.hpp 2011-02-06 10:14:10 EST (Sun, 06 Feb 2011)
@@ -67,11 +67,22 @@
     : h_(h, handle::dont_close)
     {
 #if defined(BOOST_WINDOWS_API)
- if (h != INVALID_HANDLE_VALUE &&
- !SetHandleInformation(h_.native(), HANDLE_FLAG_INHERIT,
- HANDLE_FLAG_INHERIT))
- BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR(
- "SetHandleInformation() failed");
+ if (h != INVALID_HANDLE_VALUE)
+ {
+ if (!SetHandleInformation(h_.native(), HANDLE_FLAG_INHERIT,
+ HANDLE_FLAG_INHERIT))
+ {
+ HANDLE proc = GetCurrentProcess();
+ HANDLE dup;
+ if (!DuplicateHandle(proc, h_.native(), proc, &dup, 0,
+ TRUE, DUPLICATE_SAME_ACCESS))
+ {
+ BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR(
+ "DuplicateHandle() failed");
+ }
+ h_ = dup;
+ }
+ }
 #endif
     }
 

Modified: sandbox/SOC/2010/process/libs/process/test/context.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/test/context.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/test/context.cpp 2011-02-06 10:14:10 EST (Sun, 06 Feb 2011)
@@ -39,7 +39,7 @@
     BOOST_CHECK_EQUAL(stdin_ends.child.native(), STDIN_FILENO);
     BOOST_CHECK_EQUAL(stdout_ends.child.native(), STDOUT_FILENO);
     BOOST_CHECK_EQUAL(stderr_ends.child.native(), STDERR_FILENO);
-#elif defined(BOOST_WINDOWS_API)
+#elif defined(BOOST_WINDOWS_API) && (_WIN32_WINNT < 0x0601)
     BOOST_CHECK_EQUAL(stdin_ends.child.native(),
         GetStdHandle(STD_INPUT_HANDLE));
     BOOST_CHECK_EQUAL(stdout_ends.child.native(),


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