Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62419 - in sandbox/SOC/2010/process: boost/process boost/process/detail libs/process/example
From: boris_at_[hidden]
Date: 2010-06-03 18:40:47


Author: bschaeling
Date: 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
New Revision: 62419
URL: http://svn.boost.org/trac/boost/changeset/62419

Log:
First quick review (updated copyright notes and reformatted some parts of the source code)
Text files modified:
   sandbox/SOC/2010/process/boost/process/child.hpp | 34 +++-------
   sandbox/SOC/2010/process/boost/process/config.hpp | 1
   sandbox/SOC/2010/process/boost/process/context.hpp | 25 ++-----
   sandbox/SOC/2010/process/boost/process/detail/file_handle.hpp | 90 +++++++---------------------
   sandbox/SOC/2010/process/boost/process/detail/helper_functions.hpp | 21 +-----
   sandbox/SOC/2010/process/boost/process/detail/pipe.hpp | 60 +++++--------------
   sandbox/SOC/2010/process/boost/process/detail/posix_helpers.hpp | 56 +++++------------
   sandbox/SOC/2010/process/boost/process/detail/stream_detail.hpp | 32 ++--------
   sandbox/SOC/2010/process/boost/process/detail/systembuf.hpp | 24 ++-----
   sandbox/SOC/2010/process/boost/process/detail/win32_helpers.hpp | 53 ++++------------
   sandbox/SOC/2010/process/boost/process/environment.hpp | 7 -
   sandbox/SOC/2010/process/boost/process/operations.hpp | 125 +++++++++------------------------------
   sandbox/SOC/2010/process/boost/process/pistream.hpp | 7 -
   sandbox/SOC/2010/process/boost/process/posix_child.hpp | 7 -
   sandbox/SOC/2010/process/boost/process/postream.hpp | 7 -
   sandbox/SOC/2010/process/boost/process/process.hpp | 63 +++++--------------
   sandbox/SOC/2010/process/boost/process/self.hpp | 66 ++++++++-------------
   sandbox/SOC/2010/process/boost/process/status.hpp | 10 +-
   sandbox/SOC/2010/process/boost/process/stream_behavior.hpp | 7 -
   sandbox/SOC/2010/process/libs/process/example/child_stdin.cpp | 26 +++++--
   sandbox/SOC/2010/process/libs/process/example/child_stdout.cpp | 27 +++++---
   sandbox/SOC/2010/process/libs/process/example/create_process.cpp | 55 ++++++++--------
   sandbox/SOC/2010/process/libs/process/example/process_factory.cpp | 19 ++++-
   sandbox/SOC/2010/process/libs/process/example/read_async_from_child.cpp | 45 +++++++------
   sandbox/SOC/2010/process/libs/process/example/read_async_from_parent.cpp | 29 +++++----
   sandbox/SOC/2010/process/libs/process/example/read_from_child.cpp | 21 ++++-
   sandbox/SOC/2010/process/libs/process/example/read_from_parent.cpp | 19 ++++-
   sandbox/SOC/2010/process/libs/process/example/read_info_from_process.cpp | 28 +++++---
   sandbox/SOC/2010/process/libs/process/example/terminate_child.cpp | 20 ++++-
   sandbox/SOC/2010/process/libs/process/example/wait_async_child.cpp | 40 +++++++-----
   sandbox/SOC/2010/process/libs/process/example/wait_async_process.cpp | 32 ++++++----
   sandbox/SOC/2010/process/libs/process/example/wait_child.cpp | 23 +++++--
   sandbox/SOC/2010/process/libs/process/example/wait_process.cpp | 25 +++++--
   sandbox/SOC/2010/process/libs/process/example/write_async_to_child.cpp | 33 +++++----
   sandbox/SOC/2010/process/libs/process/example/write_async_to_parent.cpp | 23 ++++--
   sandbox/SOC/2010/process/libs/process/example/write_info_to_child.cpp | 30 +++++----
   sandbox/SOC/2010/process/libs/process/example/write_info_to_self.cpp | 19 ++++-
   sandbox/SOC/2010/process/libs/process/example/write_to_child.cpp | 27 +++++---
   sandbox/SOC/2010/process/libs/process/example/write_to_parent.cpp | 19 ++++-
   39 files changed, 546 insertions(+), 709 deletions(-)

Modified: sandbox/SOC/2010/process/boost/process/child.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/child.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/child.hpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,6 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -17,38 +18,32 @@
 
 #ifndef BOOST_PROCESS_CHILD_HPP
 #define BOOST_PROCESS_CHILD_HPP
-#include <iostream>
+
 #include <boost/process/config.hpp>
 
 #if defined(BOOST_POSIX_API)
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <cerrno>
-
+# include <sys/types.h>
+# include <sys/wait.h>
+# include <cerrno>
 #elif defined(BOOST_WINDOWS_API)
-#include <windows.h>
-
+# include <windows.h>
 #else
-#error "Unsupported platform."
+# error "Unsupported platform."
 #endif
 
 #include <boost/process/process.hpp>
-
-
 #include <boost/process/pistream.hpp>
 #include <boost/process/postream.hpp>
 #include <boost/process/detail/file_handle.hpp>
-
 #include <boost/system/system_error.hpp>
 #include <boost/throw_exception.hpp>
 #include <boost/shared_ptr.hpp>
 #include <boost/assert.hpp>
+#include <iostream>
 #include <vector>
 
-namespace boost
-{
-namespace process
-{
+namespace boost {
+namespace process {
 
 /**
  * Generic implementation of the Child concept.
@@ -95,8 +90,6 @@
         return *stderr_;
     }
 
-
-
     /**
      * Creates a new child object that represents the just spawned child
      * process \a id.
@@ -116,7 +109,6 @@
             fhprocess = detail::file_handle())
         : process(id)
     {
-
 #if defined(BOOST_WINDOWS_API)
         process_handle_ = boost::shared_ptr<void>(fhprocess.release(),
                 ::CloseHandle);
@@ -130,8 +122,6 @@
             stderr_.reset(new pistream(fhstderr));
     }
 
-
-
 private:
     /**
      * The standard input stream attached to the child process.
@@ -163,7 +153,6 @@
      */
     boost::shared_ptr<pistream> stderr_;
 
-
     /**
      * Collection of child objects.
      *
@@ -171,8 +160,9 @@
      * by a vector.
      */
     typedef std::vector<child> children;
+};
 
-} ;
 }
 }
+
 #endif

Modified: sandbox/SOC/2010/process/boost/process/config.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/config.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/config.hpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,6 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Modified: sandbox/SOC/2010/process/boost/process/context.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/context.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/context.hpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,7 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
-// Copyright (c) 2010 Boris Schaeling, Felipe Tanus
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -18,19 +18,17 @@
  */
 
 #include <boost/process/config.hpp>
-#include <map>
 #include <boost/process/stream_behavior.hpp>
 #include <boost/process/environment.hpp>
 #include <boost/process/self.hpp>
-
+#include <map>
+#include <string>
 
 #ifndef BOOST_PROCESS_CONTEXT_HPP
 #define BOOST_PROCESS_CONTEXT_HPP
-namespace boost
-{
-namespace process
-{
 
+namespace boost {
+namespace process {
 
 /*
  * This is the declaration of context struct.
@@ -50,13 +48,9 @@
  */
 struct context
 {
-
- environment_t environment; //default: empty
-
- std::string process_name; //default: empty
- //io_service *ioservice; //default: NULL
+ environment_t environment;
+ std::string process_name;
     std::string work_dir;
-
     stream_behavior stdin_behavior;
     stream_behavior stdout_behavior;
     stream_behavior stderr_behavior;
@@ -68,9 +62,7 @@
         stderr_behavior = inherit;
         work_dir = self::get_work_dir();
         environment = self::get_environment();
-
     }
-
 };
 
 /*
@@ -78,12 +70,9 @@
  * It represents a context with default values that will be
  * assign to a process if no context is passed by parameter.
  */
-
 static struct context DEFAULT_CONTEXT;
 
-
 }
 }
 
-
 #endif

Modified: sandbox/SOC/2010/process/boost/process/detail/file_handle.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/detail/file_handle.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/detail/file_handle.hpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,6 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -22,12 +23,12 @@
 #include <boost/process/config.hpp>
 
 #if defined(BOOST_POSIX_API)
-#include <cerrno>
-#include <unistd.h>
+# include <cerrno>
+# include <unistd.h>
 #elif defined(BOOST_WINDOWS_API)
-#include <windows.h>
+# include <windows.h>
 #else
-#error "Unsupported platform."
+# error "Unsupported platform."
 #endif
 
 #include <boost/assert.hpp>
@@ -35,12 +36,9 @@
 #include <boost/throw_exception.hpp>
 #include <stdio.h>
 
-namespace boost
-{
-namespace process
-{
-namespace detail
-{
+namespace boost {
+namespace process {
+namespace detail {
 
 /**
  * Simple RAII model for system file handles.
@@ -179,7 +177,6 @@
         return handle_ != invalid_value();
     }
 
-
     /**
      * Reclaims ownership of the native file handle.
      *
@@ -219,7 +216,6 @@
     }
 
 #if defined(BOOST_POSIX_API) || defined(BOOST_PROCESS_DOXYGEN)
-
     /**
      * Closes the file handle.
      *
@@ -258,34 +254,18 @@
      */
     void posix_remap(handle_type &h)
     {
-
         BOOST_ASSERT(valid());
 
         if (::dup2(handle_, h) == -1)
- boost::throw_exception(boost::system::system_error(
- boost::system::error_code(errno,
- boost::system::get_system_category()),
- "boost::process::detail::file_handle::posix_remap: \
- dup2(2) failed"));
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::file_handle::posix_remap: dup2(2) failed"));
 
- if (::close(handle_) == -1){
+ if (::close(handle_) == -1)
             ::close(h);
- boost::throw_exception(boost::system::system_error(
- boost::system::error_code(errno,
- boost::system::get_system_category()),
- "boost::process::detail::file_handle::posix_remap:\
- close(2) failed"));
- }
-
- if( ::dup2(handle_,h) == -1 )
- {
- boost::throw_exception(boost::system::system_error(
- boost::system::error_code(errno,
- boost::system::get_system_category()),
- "boost::process::detail::file_handle::posix_remap:\
- dup2(2) failed"));
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::file_handle::posix_remap: close(2) failed"));
+
+ if(::dup2(handle_,h) == -1)
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::file_handle::posix_remap: dup2(2) failed"));
 
- }
         handle_ = h;
     }
 
@@ -309,17 +289,13 @@
     static file_handle duplicate(int h1, int h2)
     {
         if (::dup2(h1, h2) == -1)
- boost::throw_exception(boost::system::system_error(
- boost::system::error_code(errno,
- boost::system::get_system_category()),
- "boost::process::detail::file_handle::posix_dup:\
- dup2(2) failed"));
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::file_handle::posix_dup: dup2(2) failed"));
 
         return file_handle(h2);
     }
 #endif
-#if defined(BOOST_WINDOWS_API) || defined(BOOST_PROCESS_DOXYGEN)
 
+#if defined(BOOST_WINDOWS_API) || defined(BOOST_PROCESS_DOXYGEN)
     /**
      * Closes the file handle.
      *
@@ -354,15 +330,8 @@
     {
         HANDLE h2;
 
- if (::DuplicateHandle(::GetCurrentProcess(), h,
- ::GetCurrentProcess(), &h2, 0,
- inheritable ? TRUE : FALSE, DUPLICATE_SAME_ACCESS) ==0 )
- boost::throw_exception(boost::system::system_error(
- boost::system::error_code(::GetLastError(),
- boost::system::get_system_category()),
- "boost::process::detail::file_handle::win32_dup:\
- DuplicateHandle failed"));
-
+ if (::DuplicateHandle(::GetCurrentProcess(), h, ::GetCurrentProcess(), &h2, 0, inheritable ? TRUE : FALSE, DUPLICATE_SAME_ACCESS) == 0)
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::detail::file_handle::win32_dup: DuplicateHandle failed"));
 
         return file_handle(h2);
     }
@@ -384,26 +353,16 @@
      * \throw boost::system::system_error If GetStdHandle() or
      * DuplicateHandle() fails.
      */
-
     static file_handle win32_dup_std(DWORD d, bool inheritable)
     {
- BOOST_ASSERT(d == STD_INPUT_HANDLE || d == STD_OUTPUT_HANDLE
- || d == STD_ERROR_HANDLE);
-
-
+ BOOST_ASSERT(d == STD_INPUT_HANDLE || d == STD_OUTPUT_HANDLE || d == STD_ERROR_HANDLE);
         HANDLE h = ::GetStdHandle(d);
         if (h == INVALID_HANDLE_VALUE)
- boost::throw_exception(boost::system::system_error(
- boost::system::error_code(::GetLastError(),
- boost::system::get_system_category()),
- "boost::process::detail::file_handle::win32_std:
- GetStdHandle failed"));
-
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::detail::file_handle::win32_std:GetStdHandle failed"));
         file_handle dh = win32_dup(h, inheritable);
         return dh;
     }
 
-
     /**
      * Changes the file handle's inheritable flag.
      *
@@ -420,13 +379,8 @@
     {
         BOOST_ASSERT(valid());
 
- if (!::SetHandleInformation(handle_, HANDLE_FLAG_INHERIT, i ?
- HANDLE_FLAG_INHERIT : 0))
- boost::throw_exception(boost::system::system_error(
- boost::system::error_code(::GetLastError(),
- boost::system::get_system_category()),
- "boost::process::detail::file_handle::win32_set_inheritable:\
- SetHandleInformation failed"));
+ if (!::SetHandleInformation(handle_, HANDLE_FLAG_INHERIT, i ? HANDLE_FLAG_INHERIT : 0))
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::detail::file_handle::win32_set_inheritable: SetHandleInformation failed"));
     }
 #endif
 

Modified: sandbox/SOC/2010/process/boost/process/detail/helper_functions.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/detail/helper_functions.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/detail/helper_functions.hpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,7 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
-// Copyright (c) 2010 Boris Schaeling, Felipe Tanus
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -18,28 +18,17 @@
  *
  */
 
-#if defined(BOOST_POSIX_API)
- #include <unistd.h>
- #include <sys/stat.h>
- #include <fcntl.h>
-#endif
-#include <map>
-#include <string.h>
-#include <boost/optional.hpp>
-#include <boost/process/stream_behavior.hpp>
-
-
+#include <boost/process/config.hpp>
 
 #ifndef BOOST_PROCESS_HELPER_FUNCTIONS_HPP
 #define BOOST_PROCESS_HELPER_FUNCTIONS_HPP
-namespace boost{
-namespace process{
-namespace detail{
 
+namespace boost {
+namespace process {
+namespace detail {
 
 }
 }
 }
 
-
 #endif

Modified: sandbox/SOC/2010/process/boost/process/detail/pipe.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/detail/pipe.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/detail/pipe.hpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,6 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -38,12 +39,9 @@
 #include <boost/system/system_error.hpp>
 #include <boost/throw_exception.hpp>
 
-namespace boost
-{
-namespace process
-{
-namespace detail
-{
+namespace boost {
+namespace process {
+namespace detail {
 
 /**
  * Simple RAII model for anonymous pipes.
@@ -86,45 +84,28 @@
 
 #if defined(BOOST_POSIX_API)
         if (::pipe(hs) == -1)
- boost::throw_exception(boost::system::system_error(
- boost::system::error_code(
- errno, boost::system::get_system_category()),
- "boost::process::detail::pipe::pipe: pipe(2) failed"));
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::pipe::pipe: pipe(2) failed"));
 #elif defined(BOOST_WINDOWS_API)
-
         SECURITY_ATTRIBUTES sa;
         ZeroMemory(&sa, sizeof(sa));
         sa.nLength = sizeof(sa);
-
         sa.lpSecurityDescriptor = NULL;
         sa.bInheritHandle = TRUE;
-
-#if defined(BOOST_PROCESS_WINDOWS_USE_NAMED_PIPE)
+# if defined(BOOST_PROCESS_WINDOWS_USE_NAMED_PIPE)
         static unsigned int nextid = 0;
- std::string pipe = "\\\\.\\pipe\\boost_process_" +
- boost::lexical_cast<std::string>(::GetCurrentProcessId()) + "_"
- + boost::lexical_cast<std::string>(nextid++);
- hs[0] = ::CreateNamedPipeA(pipe.c_str(), PIPE_ACCESS_INBOUND |
- FILE_FLAG_OVERLAPPED, 0, 1, 8192, 8192, 0, &sa);
+ std::string pipe = "\\\\.\\pipe\\boost_process_" + boost::lexical_cast<std::string>(::GetCurrentProcessId()) + "_" + boost::lexical_cast<std::string>(nextid++);
+ hs[0] = ::CreateNamedPipeA(pipe.c_str(), PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED, 0, 1, 8192, 8192, 0, &sa);
         if (hs[0] == INVALID_HANDLE_VALUE)
- boost::throw_exception(boost::system::system_error(::GetLastError(),
- boost::system::system_category,
- "boost::process::detail::pipe::pipe:\
- CreateNamedPipe failed"));
- hs[1] = ::CreateFileA(pipe.c_str(), GENERIC_WRITE, 0, NULL,\
- OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
+ boost::throw_exception(boost::system::system_error(::GetLastError(), boost::system::system_category, "boost::process::detail::pipe::pipe: CreateNamedPipe failed"));
+ hs[1] = ::CreateFileA(pipe.c_str(), GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
         if (hs[1] == INVALID_HANDLE_VALUE)
- boost::throw_exception(boost::system::system_error(::GetLastError(),\
- boost::system::system_category,
- "boost::process::detail::pipe::pipe: CreateFile failed"));
+ boost::throw_exception(boost::system::system_error(::GetLastError(), boost::system::system_category, "boost::process::detail::pipe::pipe: CreateFile failed"));
 
         OVERLAPPED overlapped;
         ZeroMemory(&overlapped, sizeof(overlapped));
         overlapped.hEvent = ::CreateEvent(NULL, TRUE, FALSE, NULL);
         if (!overlapped.hEvent)
- boost::throw_exception(boost::system::system_error(::GetLastError(),
- boost::system::system_category,
- "boost::process::detail::pipe::pipe: CreateEvent failed"));
+ boost::throw_exception(boost::system::system_error(::GetLastError(), boost::system::system_category, "boost::process::detail::pipe::pipe: CreateEvent failed"));
         BOOL b = ::ConnectNamedPipe(hs[0], &overlapped);
         if (!b)
         {
@@ -134,28 +115,19 @@
                         == WAIT_FAILED)
                 {
                     ::CloseHandle(overlapped.hEvent);
- boost::throw_exception(boost::system::system_error(
- ::GetLastError(),
- boost::system::system_category,
- "boost::process::detail::pipe::pipe:\
- WaitForSingleObject failed"));
+ boost::throw_exception(boost::system::system_error(::GetLastError(), boost::system::system_category, "boost::process::detail::pipe::pipe: WaitForSingleObject failed"));
                 }
             }
             else if (::GetLastError() != ERROR_PIPE_CONNECTED)
             {
                 ::CloseHandle(overlapped.hEvent);
- boost::throw_exception(boost::system::system_error(
- ::GetLastError(), boost::system::system_category,
- "boost::process::detail::pipe::pipe:\
- ConnectNamedPipe failed"));
+ boost::throw_exception(boost::system::system_error(::GetLastError(), boost::system::system_category, "boost::process::detail::pipe::pipe: ConnectNamedPipe failed"));
             }
         }
         ::CloseHandle(overlapped.hEvent);
-#else
+# else
         if (!::CreatePipe(&hs[0], &hs[1], &sa, 0))
- boost::throw_exception(boost::system::system_error(::GetLastError(),
- boost::system::system_category,
- "boost::process::detail::pipe::pipe: CreatePipe failed"));
+ boost::throw_exception(boost::system::system_error(::GetLastError(), boost::system::system_category, "boost::process::detail::pipe::pipe: CreatePipe failed"));
 # endif
 #endif
 

Modified: sandbox/SOC/2010/process/boost/process/detail/posix_helpers.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/detail/posix_helpers.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/detail/posix_helpers.hpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,7 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
-// Copyright (c) 2010 Boris Schaeling, Felipe Tanus
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -18,30 +18,27 @@
  *
  */
 
+#include <boost/process/config.hpp>
 
 #if defined(BOOST_POSIX_API)
-#include <unistd.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdio.h>
+# include <unistd.h>
+# include <sys/stat.h>
+# include <fcntl.h>
+# include <stdio.h>
 #endif
-#include <map>
-#include <string.h>
+
 #include <boost/optional.hpp>
 #include <boost/process/stream_behavior.hpp>
 #include <boost/process/detail/stream_detail.hpp>
-
+#include <map>
+#include <string.h>
 
 #ifndef BOOST_PROCESS_POSIX_HELPERS_HPP
 #define BOOST_PROCESS_POSIX_HELPERS_HPP
-namespace boost
-{
-namespace process
-{
-namespace detail
-{
-
 
+namespace boost {
+namespace process {
+namespace detail {
 
 /*
  * This is the declaration of configure_stream function.
@@ -53,12 +50,10 @@
  */
 inline configure_child_posix_stream(stream_detail &s)
 {
-
- switch(s.behavior)
+ switch (s.behavior)
     {
     case dummy:
     {
-
         std::string null_file;
         if(s.stream_type == stdin_type)
             null_file = "/dev/null";
@@ -72,29 +67,21 @@
             fd = ::open(null_file.c_str(), O_WRONLY);
 
         if (fd == -1)
- boost::throw_exception(boost::system::system_error(
- boost::system::error_code(errno,
- boost::system::get_system_category()),
- "boost::process::detail::setup_input: open(2) of "
- + s.object.file_ + " failed"));
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::setup_input: open(2) of " + s.object.file_ + " failed"));
 
         s.object.handle_ = file_handle(fd);
         s.object.handle_.posix_remap(s.stream_handle);
         s.object.handle_.release();
-
         break;
     }
-
     case closed:
         ::close(s.stream_handle);
         break;
-
     case inherit:
         //do nothing since is default?
         break;
-
     case capture:
- if(s.stream_type == stdin_type)
+ if (s.stream_type == stdin_type)
         {
             s.object.pipe_.wend().close();
             s.object.pipe_.rend().posix_remap(s.stream_handle);
@@ -104,16 +91,12 @@
             s.object.pipe_.rend().close();
             s.object.pipe_.wend().posix_remap(s.stream_handle);
         }
-
         break;
-
     default:
         BOOST_ASSERT(false);
     }
-
 }
 
-
 /**
  * Converts an environment to a char** table as used by execve().
  *
@@ -128,7 +111,7 @@
  * the environment's content. Each array entry is a
  * NULL-terminated string of the form var=value.
  */
-inline char ** environment_to_envp( environment_t env)
+inline char **environment_to_envp(environment_t env)
 {
     char **envp = new char*[env.size() + 1];
 
@@ -159,16 +142,14 @@
  * to the executable. The caller is responsible of freeing them.
  */
 template <class Arguments>
-inline std::pair<std::size_t, char**> collection_to_posix_argv(const Arguments
- &args)
+inline std::pair<std::size_t, char**> collection_to_posix_argv(const Arguments &args)
 {
     std::size_t nargs = args.size();
     BOOST_ASSERT(nargs >= 0);
 
     char **argv = new char*[nargs + 1];
     typename Arguments::size_type i = 0;
- for (typename Arguments::const_iterator it = args.begin();
- it != args.end(); ++it)
+ for (typename Arguments::const_iterator it = args.begin(); it != args.end(); ++it)
     {
         argv[i] = new char[it->size() + 1];
         ::strncpy(argv[i], it->c_str(), it->size() + 1);
@@ -183,5 +164,4 @@
 }
 }
 
-
 #endif

Modified: sandbox/SOC/2010/process/boost/process/detail/stream_detail.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/detail/stream_detail.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/detail/stream_detail.hpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,7 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
-// Copyright (c) 2010 Boris Schaeling, Felipe Tanus
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -19,23 +19,18 @@
  */
 
 #include <boost/process/config.hpp>
-#include <map>
-#include <boost/optional.hpp>
 #include <boost/process/stream_behavior.hpp>
 #include <boost/process/detail/file_handle.hpp>
 #include <boost/process/detail/pipe.hpp>
-
-
+#include <boost/optional.hpp>
+#include <map>
 
 #ifndef BOOST_PROCESS_STREAM_DETAIL_HPP
 #define BOOST_PROCESS_STREAM_DETAIL_HPP
-namespace boost
-{
-namespace process
-{
-namespace detail
-{
 
+namespace boost {
+namespace process {
+namespace detail {
 
 /*
  * This is the declaration of stream_object.
@@ -43,7 +38,6 @@
  * representation. For example, it can point to another stream or
  * to a pipe.
  */
-
 struct stream_object
 {
     int desc_to;
@@ -52,13 +46,11 @@
     pipe pipe_;
 };
 
-
 /*
  * This defines the std_stream_type enum.
  * It lists all possible std stream types.
  */
-enum std_stream_type {stdin_type=0, stdout_type=1, stderr_type=2};
-
+enum std_stream_type { stdin_type = 0, stdout_type = 1, stderr_type = 2 };
 
 /*
  * This is the declaration of a stream detail.
@@ -72,10 +64,8 @@
  * object: The object required to this behavior (see stream_object above)
  *
  */
-
 struct stream_detail
 {
-
 #if defined(BOOST_POSIX_API)
     int stream_handle;
 #elif defined(BOOST_WINDOWS_API)
@@ -94,7 +84,6 @@
         {
         case stdin_type:
         {
-
 #if defined(BOOST_POSIX_API)
             stream_handle = STDIN_FILENO;
 #elif defined(BOOST_WINDOWS_API)
@@ -122,21 +111,14 @@
         }
         default:
         {
-
             BOOST_ASSERT(false);
         }
-
-
         }
-
     }
 };
 
-
-
 }
 }
 }
 
-
 #endif

Modified: sandbox/SOC/2010/process/boost/process/detail/systembuf.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/detail/systembuf.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/detail/systembuf.hpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,6 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -22,13 +23,12 @@
 #include <boost/process/config.hpp>
 
 #if defined(BOOST_POSIX_API)
-#include <sys/types.h>
-#include <unistd.h>
-
+# include <sys/types.h>
+# include <unistd.h>
 #elif defined(BOOST_WINDOWS_API)
-#include <windows.h>
+# include <windows.h>
 #else
-#error "Unsupported platform."
+# error "Unsupported platform."
 #endif
 
 #include <boost/noncopyable.hpp>
@@ -37,15 +37,12 @@
 #include <streambuf>
 #include <cstddef>
 
-namespace boost
-{
-namespace process
-{
+namespace boost {
+namespace process {
 
 class postream;
 
-namespace detail
-{
+namespace detail {
 
 /**
  * std::streambuf implementation for system file handles.
@@ -61,7 +58,6 @@
  */
 class systembuf : public std::streambuf, public boost::noncopyable
 {
-
     friend class ::boost::process::postream;
 
 public:
@@ -90,7 +86,6 @@
      *
      * \see pistream and postream
      */
-
     explicit systembuf(handle_type h, std::size_t bufsize = 8192)
         : handle_(h),
           bufsize_(bufsize),
@@ -103,7 +98,6 @@
         BOOST_ASSERT(handle_ != INVALID_HANDLE_VALUE);
 #endif
         BOOST_ASSERT(bufsize_ > 0);
-
         setp(write_buf_.get(), write_buf_.get() + bufsize_);
     }
 
@@ -186,8 +180,6 @@
      *
      * \returns 0 on success, -1 if an error occurred.
      */
-
-
 #if defined(BOOST_POSIX_API)
     virtual int sync()
     {

Modified: sandbox/SOC/2010/process/boost/process/detail/win32_helpers.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/detail/win32_helpers.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/detail/win32_helpers.hpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,7 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
-// Copyright (c) 2010 Boris Schaeling, Felipe Tanus
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -18,10 +18,14 @@
  *
  */
 
+#ifndef BOOST_PROCESS_WIN32_HELPERS_HPP
+#define BOOST_PROCESS_WIN32_HELPERS_HPP
+
+#include <boost/process/config.hpp>
+#include <boost/process/child.hpp>
 #include <boost/process/detail/file_handle.hpp>
 #include <boost/process/detail/stream_detail.hpp>
 #include <boost/process/detail/pipe.hpp>
-#include <boost/process/child.hpp>
 #include <boost/scoped_ptr.hpp>
 #include <boost/shared_array.hpp>
 #include <boost/scoped_array.hpp>
@@ -35,16 +39,9 @@
 #include <string.h>
 #include <windows.h>
 
-
-
-#ifndef BOOST_PROCESS_WIN32_HELPERS_HPP
-#define BOOST_PROCESS_WIN32_HELPERS_HPP
-namespace boost
-{
-namespace process
-{
-namespace detail
-{
+namespace boost {
+namespace process {
+namespace detail {
 
 /**
  * Converts an environment to a string used by CreateProcess().
@@ -88,8 +85,6 @@
     return envp;
 }
 
-
-
 /**
  * Converts the command line to a plain string. Converts the command line's
  * list of arguments to the format expected by the \a lpCommandLine parameter
@@ -102,15 +97,13 @@
  * shared_array object to ensure its release at some point.
  */
 template <class Arguments>
-inline boost::shared_array<char> collection_to_win32_cmdline(const Arguments
- &args)
+inline boost::shared_array<char> collection_to_win32_cmdline(const Arguments &args)
 {
     typedef std::vector<std::string> arguments_t;
     arguments_t args2;
     typename Arguments::size_type i = 0;
     std::size_t size = 0;
- for (typename Arguments::const_iterator it = args.begin();
- it != args.end(); ++it)
+ for (typename Arguments::const_iterator it = args.begin(); it != args.end(); ++it)
     {
         std::string arg = *it;
 
@@ -150,7 +143,6 @@
  */
 inline file_handle configure_win32_stream(stream_detail &sd)
 {
-
     file_handle return_handle;
 
     switch (sd.behavior)
@@ -165,32 +157,20 @@
         return_handle = file_handle::win32_dup_std(sd.stream_handle, true);
         break;
     }
-
     case dummy:
     {
         HANDLE h;
         if(sd.stream_type == stdin_type)
         {
- h = ::CreateFileA("NUL",
- GENERIC_READ, 0, NULL, OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL, NULL);
-
+ h = ::CreateFileA("NUL", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
         }
         else
         {
- h = ::CreateFileA("NUL",
- GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL, NULL);
+ h = ::CreateFileA("NUL", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
         }
-
         if (h == INVALID_HANDLE_VALUE)
- boost::throw_exception(boost::system::system_error(
- boost::system::error_code(::GetLastError(),
- boost::system::get_system_category()),
- "boost::process::detail::win32_start: CreateFile failed"));
-
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::detail::win32_start: CreateFile failed"));
         return_handle = file_handle(h);
-
         break;
     }
 
@@ -213,19 +193,14 @@
     default:
     {
         BOOST_ASSERT(false);
-
     }
     }
 
     return return_handle;
-
-
 }
 
-
 }
 }
 }
 
-
 #endif

Modified: sandbox/SOC/2010/process/boost/process/environment.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/environment.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/environment.hpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,6 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -21,10 +22,8 @@
 #include <string>
 #include <map>
 
-namespace boost
-{
-namespace process
-{
+namespace boost {
+namespace process {
 
 /**
  * Representation of a process' environment variables.

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 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,6 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -21,17 +22,17 @@
 #include <boost/process/config.hpp>
 
 #if defined(BOOST_POSIX_API)
-#include <boost/process/detail/posix_helpers.hpp>
-#include <stdlib.h>
-#include <unistd.h>
-#if defined(__CYGWIN__)
-#include <boost/scoped_array.hpp>
-#include <sys/cygwin.h>
-#endif
+# include <boost/process/detail/posix_helpers.hpp>
+# include <stdlib.h>
+# include <unistd.h>
+# if defined(__CYGWIN__)
+# include <boost/scoped_array.hpp>
+# include <sys/cygwin.h>
+# endif
 #elif defined(BOOST_WINDOWS_API)
-#include <boost/process/detail/win32_helpers.hpp>
-#include <boost/algorithm/string/predicate.hpp>
-#include <windows.h>
+# include <boost/process/detail/win32_helpers.hpp>
+# include <boost/algorithm/string/predicate.hpp>
+# include <windows.h>
 #else
 # error "Unsupported platform."
 #endif
@@ -42,8 +43,6 @@
 #include <boost/process/status.hpp>
 #include <boost/process/detail/file_handle.hpp>
 #include <boost/process/detail/stream_detail.hpp>
-
-
 #include <boost/filesystem/path.hpp>
 #include <boost/algorithm/string/predicate.hpp>
 #include <boost/system/system_error.hpp>
@@ -55,11 +54,8 @@
 #include <stdexcept>
 #include <cstddef>
 
-
-namespace boost
-{
-namespace process
-{
+namespace boost {
+namespace process {
 
 /**
  * Locates the executable program \a file in all the directory components
@@ -84,20 +80,12 @@
     std::string result;
 
 #if defined(BOOST_POSIX_API)
-
     if (path.empty())
     {
         const char *envpath = ::getenv("PATH");
         if (!envpath)
- {
- boost::throw_exception(
- boost::filesystem::filesystem_error(
- "boost::process::find_executable_in_path: retrieving PATH\
- failed", file, boost::system::errc::make_error_code(
- boost::system::errc::no_such_file_or_directory)));
- }
+ boost::throw_exception(boost::filesystem::filesystem_error("boost::process::find_executable_in_path: retrieving PATH failed", file, boost::system::errc::make_error_code(boost::system::errc::no_such_file_or_directory)));
         path = envpath;
-
     }
     BOOST_ASSERT(!path.empty());
 
@@ -121,9 +109,7 @@
         else
             path.substr(pos1);
 
- std::string f = dir +
- (boost::algorithm::ends_with(dir, "/") ? "" : "/") +
- file;
+ std::string f = dir + (boost::algorithm::ends_with(dir, "/") ? "" : "/") + file;
 
         if (!::access(f.c_str(), X_OK))
             result = f;
@@ -132,7 +118,6 @@
     while (pos2 != std::string::npos && result.empty());
 
 #elif defined(BOOST_WINDOWS_API)
-
     const char *exts[] = { "", ".exe", ".com", ".bat", NULL };
     const char **ext = exts;
 
@@ -141,10 +126,7 @@
         char buf[MAX_PATH];
         char *dummy;
 
- DWORD size = ::SearchPathA(
- path.empty() ? NULL :
- path.c_str(), file.c_str(), *ext, MAX_PATH, buf, &dummy);
-
+ DWORD size = ::SearchPathA(path.empty() ? NULL : path.c_str(), file.c_str(), *ext, MAX_PATH, buf, &dummy);
         BOOST_ASSERT(size < MAX_PATH);
 
         if (size > 0)
@@ -154,16 +136,10 @@
         }
         ++ext;
     }
-
 #endif
+
     if (result.empty())
- {
- boost::throw_exception(
- boost::filesystem::filesystem_error(
- "boost::process::find_executable_in_path: file not found", file,
- boost::system::errc::make_error_code(
- boost::system::errc::no_such_file_or_directory)));
- }
+ boost::throw_exception(boost::filesystem::filesystem_error("boost::process::find_executable_in_path: file not found", file, boost::system::errc::make_error_code(boost::system::errc::no_such_file_or_directory)));
 
     return result;
 }
@@ -189,12 +165,7 @@
         begin = slash + 1;
 
 #if defined(BOOST_WINDOWS_API)
- if (exe.size() > 4 &&
- (boost::algorithm::iends_with(exe, ".exe")
- || boost::algorithm::iends_with(exe, ".com")
- || boost::algorithm::iends_with(exe, ".bat")
- )
- )
+ if (exe.size() > 4 && (boost::algorithm::iends_with(exe, ".exe") || boost::algorithm::iends_with(exe, ".com") || boost::algorithm::iends_with(exe, ".bat")))
         end = exe.size() - 4;
 #endif
 
@@ -214,14 +185,10 @@
  *
  * \return A handle to the new child process.
  */
-
-
-
 template<class Arguments>
 inline child create_child(const std::string &executable, Arguments args,
         context &ctx = DEFAULT_CONTEXT)
 {
-
     detail::file_handle fhstdin, fhstdout, fhstderr;
 
     //start structures that represents a std stream.
@@ -237,36 +204,25 @@
     std::string p_name = ctx.process_name.empty() ? executable:ctx.process_name;
     args.insert(args.begin(),p_name);
 
-
 #if defined(BOOST_POSIX_API)
-
     child::id_type pid = ::fork();
 
     if (pid == -1)
- {
- boost::throw_exception(
- boost::system::system_error(
- boost::system::error_code(errno,
- boost::system::get_system_category()),
- "boost::process::detail::posix_start: fork(2) failed"));
- }
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::detail::posix_start: fork(2) failed"));
 
     if (pid == 0)
     {
-
         //configure child pipes
         detail::configure_posix_stream(stdin_stream);
         detail::configure_posix_stream(stdout_stream);
         detail::configure_posix_stream(stderr_stream);
 
         //execve call
- std::pair<std::size_t, char**> argcv =
- detail::collection_to_posix_argv(args);
+ std::pair<std::size_t, char**> argcv = detail::collection_to_posix_argv(args);
         char **envp = detail::environment_to_envp(ctx.environment);
         ::execve(executable.c_str(), argcv.second, envp);
 
         BOOST_ASSERT(false);
-
     }
 
     BOOST_ASSERT(pid > 0);
@@ -293,14 +249,8 @@
         BOOST_ASSERT(fhstderr.valid());
     }
 
-
-
     return child(pid, fhstdin, fhstdout, fhstderr);
-
-
 #elif defined(BOOST_WINDOWS_API)
-
-
     //Set up the pipes when needed for the current process.
     if (stdin_stream.behavior == capture)
         fhstdin = stdin_stream.object.pipe_.wend();
@@ -309,7 +259,6 @@
     if (stderr_stream.behavior == capture)
         fhstderr = stderr_stream.object.pipe_.rend();
 
-
     //define startup info from the new child
     STARTUPINFOA startup_info;
     ::ZeroMemory(&startup_info, sizeof(startup_info));
@@ -333,7 +282,6 @@
     if(fh.valid())
         startup_info.hStdError = fh.get();
 
-
     //define process info and create it
     PROCESS_INFORMATION pi;
     ::ZeroMemory(&pi, sizeof(pi));
@@ -350,39 +298,24 @@
         detail::environment_to_win32_strings(ctx.environment);
 
     //create the process
- if ( ::CreateProcessA(exe.get(), cmdline.get(),
- NULL, NULL, TRUE, 0, envstrs.get(), workdir.get(),
- &startup_info, &pi) == 0)
-
- boost::throw_exception(boost::system::system_error(
- boost::system::error_code(::GetLastError(),
- boost::system::get_system_category()),
- "boost::process::detail::win32_start:\
- CreateProcess failed"));
-
- if (! ::CloseHandle(pi.hThread))
- boost::throw_exception(
- boost::system::system_error(boost::system::error_code(
- ::GetLastError(),
- boost::system::get_system_category()),
- "boost::process::launch: CloseHandle\
- failed"));
-
- std::cout << "Process handle passado para o child:" <<
- pi.hProcess << std::endl;
- return child(pi.dwProcessId, fhstdin, fhstdout, fhstderr,
- detail::file_handle(pi.hProcess));
+ if (::CreateProcessA(exe.get(), cmdline.get(), NULL, NULL, TRUE, 0, envstrs.get(), workdir.get(), &startup_info, &pi) == 0)
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::detail::win32_start: CreateProcess failed"));
+
+ if (!::CloseHandle(pi.hThread))
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::launch: CloseHandle failed"));
 
+ std::cout << "Process handle passado para o child:" << pi.hProcess << std::endl;
+ return child(pi.dwProcessId, fhstdin, fhstdout, fhstderr, detail::file_handle(pi.hProcess));
 #endif
 }
 
-
 inline child create_child(const std::string &executable,
         context &ctx = DEFAULT_CONTEXT)
 {
     std::vector<std::string> args ;
     return create_child(executable,args,ctx);
 }
+
 }
 }
 

Modified: sandbox/SOC/2010/process/boost/process/pistream.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/pistream.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/pistream.hpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,6 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -23,10 +24,8 @@
 #include <boost/noncopyable.hpp>
 #include <istream>
 
-namespace boost
-{
-namespace process
-{
+namespace boost {
+namespace process {
 
 /**
  * Child process' output stream.

Modified: sandbox/SOC/2010/process/boost/process/posix_child.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/posix_child.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/posix_child.hpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,6 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -29,10 +30,8 @@
 #include <map>
 #include <unistd.h>
 
-namespace boost
-{
-namespace process
-{
+namespace boost {
+namespace process {
 
 /**
  * POSIX implementation of the Child concept.

Modified: sandbox/SOC/2010/process/boost/process/postream.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/postream.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/postream.hpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,6 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -23,10 +24,8 @@
 #include <boost/noncopyable.hpp>
 #include <ostream>
 
-namespace boost
-{
-namespace process
-{
+namespace boost {
+namespace process {
 
 /**
  * Child process' input stream.

Modified: sandbox/SOC/2010/process/boost/process/process.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/process.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/process.hpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,6 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -18,28 +19,25 @@
 #ifndef BOOST_PROCESS_PROCESS_HPP
 #define BOOST_PROCESS_PROCESS_HPP
 
-
 #include <boost/process/config.hpp>
-#include <boost/process/status.hpp>
 
 #if defined(BOOST_POSIX_API)
-#include <cerrno>
-#include <signal.h>
+# include <cerrno>
+# include <signal.h>
 #elif defined(BOOST_WINDOWS_API)
-#include <cstdlib>
-#include <windows.h>
+# include <cstdlib>
+# include <windows.h>
 #else
-#error "Unsupported platform."
+# error "Unsupported platform."
 #endif
 
+#include <boost/process/status.hpp>
 #include <boost/system/system_error.hpp>
 #include <boost/throw_exception.hpp>
 #include <boost/shared_ptr.hpp>
 
-namespace boost
-{
-namespace process
-{
+namespace boost {
+namespace process {
 
 /**
  * Generic implementation of the Process concept.
@@ -108,35 +106,20 @@
     {
 #if defined(BOOST_POSIX_API)
         if (::kill(id_, force ? SIGKILL : SIGTERM) == -1)
- boost::throw_exception(boost::system::system_error(
- boost::system::error_code(
- errno, boost::system::get_system_category()),
- "boost::process::process::terminate: kill(2) failed"));
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::process::terminate: kill(2) failed"));
 
 #elif defined(BOOST_WINDOWS_API)
         HANDLE h = ::OpenProcess(PROCESS_TERMINATE, FALSE, id_);
         if (h == NULL)
- boost::throw_exception(boost::system::system_error(
- boost::system::error_code(::GetLastError(),
- boost::system::get_system_category()),
- "boost::process::process::terminate:\
- OpenProcess failed"));
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::process::terminate: OpenProcess failed"));
 
         if (!::TerminateProcess(h, EXIT_FAILURE))
         {
             ::CloseHandle(h);
- boost::throw_exception(boost::system::system_error(
- boost::system::error_code(::GetLastError(),
- boost::system::get_system_category()),
- "boost::process::process::terminate:\
- TerminateProcess failed"));
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::process::terminate: TerminateProcess failed"));
         }
         if (!::CloseHandle(h))
- boost::throw_exception(boost::system::system_error(
- boost::system::error_code(::GetLastError(),
- boost::system::get_system_category()),
- "boost::process::process::terminate:\
- CloseHandle failed"));
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::process::terminate: CloseHandle failed"));
 #endif
     }
     /**
@@ -155,34 +138,22 @@
 #if defined(BOOST_POSIX_API)
         int s;
         if (::waitpid(get_id(), &s, 0) == -1)
- boost::throw_exception(boost::system::system_error(
- boost::system::error_code(errno,
- boost::system::get_system_category()),
- "boost::process::child::wait: waitpid(2) failed"));
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::child::wait: waitpid(2) failed"));
         return status(s);
 #elif defined(BOOST_WINDOWS_API)
         std::cout << "Criado com ID " << process_handle_.get() << std::endl;
         if(::WaitForSingleObject(process_handle_.get(),INFINITE) == WAIT_FAILED)
         {
-
             std::cout << "Last error:" << GetLastError() << std::endl;
             std::cout << "Criado com ID " << process_handle_.get() << std::endl;
-
         }
         DWORD code;
         if (!::GetExitCodeProcess(process_handle_.get(), &code))
- {
- boost::throw_exception(boost::system::system_error(
- boost::system::error_code(::GetLastError(),
- boost::system::get_system_category()),
- "boost::process::child::wait:\
- GetExitCodeProcess failed"));
- }
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::child::wait: GetExitCodeProcess failed"));
         return status(code);
 #endif
     }
 
-
 #if defined(BOOST_WINDOWS_API)
     /**
      * Process handle owned by RAII object.
@@ -195,9 +166,9 @@
      * The process' identifier.
      */
     id_type id_;
-
-
 };
+
 }
 }
+
 #endif

Modified: sandbox/SOC/2010/process/boost/process/self.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/self.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/self.hpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,6 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -21,17 +22,15 @@
 #include <boost/process/config.hpp>
 
 #if defined(BOOST_POSIX_API)
-#include <unistd.h>
-
-#if defined(__APPLE__)
-#include <crt_externs.h>
-#endif
-
+# include <unistd.h>
+# if defined(__APPLE__)
+# include <crt_externs.h>
+# endif
 #elif defined(BOOST_WINDOWS_API)
-#include <windows.h>
-#include <direct.h>
+# include <windows.h>
+# include <direct.h>
 #else
-#error "Unsupported platform."
+# error "Unsupported platform."
 #endif
 
 #include <boost/process/process.hpp>
@@ -49,10 +48,8 @@
 }
 #endif
 
-namespace boost
-{
-namespace process
-{
+namespace boost {
+namespace process {
 
 /**
  * Generic implementation of the Process concept.
@@ -84,33 +81,28 @@
         environment_t e;
 
 #if defined(BOOST_POSIX_API)
-#if defined(__APPLE__)
+# if defined(__APPLE__)
         char **env = *_NSGetEnviron();
-#else
+# else
         char **env = ::environ;
-#endif
+# endif
 
         while (*env)
         {
             std::string s = *env;
             std::string::size_type pos = s.find('=');
- e.insert(boost::process::environment_t::value_type(
- s.substr(0, pos), s.substr(pos + 1)));
+ e.insert(boost::process::environment_t::value_type(s.substr(0, pos), s.substr(pos + 1)));
             ++env;
         }
 
 #elif defined(BOOST_WINDOWS_API)
-#ifdef GetEnvironmentStrings
-#undef GetEnvironmentStrings
-#endif
+# ifdef GetEnvironmentStrings
+# undef GetEnvironmentStrings
+# endif
 
         char *ms_environ = ::GetEnvironmentStrings();
         if (!ms_environ)
- boost::throw_exception(boost::system::system_error(
- boost::system::error_code(::GetLastError(),
- boost::system::get_system_category()),
- "boost::process::self::get_environment:\
- GetEnvironmentStrings failed"));
+ boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::self::get_environment: GetEnvironmentStrings failed"));
         try
         {
             char *env = ms_environ;
@@ -118,9 +110,7 @@
             {
                 std::string s = env;
                 std::string::size_type pos = s.find('=');
- e.insert(boost::process::environment_t::value_type(
- s.substr(0, pos), s.substr(pos + 1))
- );
+ e.insert(boost::process::environment_t::value_type(s.substr(0, pos), s.substr(pos + 1)));
                 env += s.size() + 1;
             }
         }
@@ -135,25 +125,19 @@
         return e;
     }
 
-
- static char * get_work_dir()
+ static char *get_work_dir()
     {
 #if defined(BOOST_POSIX_API)
         int size = pathconf(".",_PC_PATH_MAX);
- char * buffer = (char *)malloc(size);
- if(buffer == NULL)
+ char *buffer = (char *)malloc(size);
+ if (!buffer)
             BOOST_ASSERT(false);
         return getcwd(buffer, size);
-
 #elif defined(BOOST_WINDOWS_API)
-
         char* buffer;
-
- BOOST_ASSERT( (buffer = _getcwd( NULL, 0 )) != NULL );
+ BOOST_ASSERT((buffer = _getcwd( NULL, 0 )) != NULL);
         return buffer;
-
 #endif
-
     }
 
 private:
@@ -168,8 +152,8 @@
 #elif defined(BOOST_WINDOWS_API)
         process(::GetCurrentProcessId())
 #endif
- {}
-
+ {
+ }
 };
 
 }

Modified: sandbox/SOC/2010/process/boost/process/status.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/status.hpp (original)
+++ sandbox/SOC/2010/process/boost/process/status.hpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,6 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -21,19 +22,16 @@
 #include <boost/process/config.hpp>
 
 #if defined(BOOST_POSIX_API)
-#include <sys/wait.h>
+# include <sys/wait.h>
 #elif defined(BOOST_WINDOWS_API)
-
 #else
 # error "Unsupported platform."
 #endif
 
 #include <boost/assert.hpp>
 
-namespace boost
-{
-namespace process
-{
+namespace boost {
+namespace process {
 
 class process;
 

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 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -4,6 +4,7 @@
 //
 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
 // Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -21,10 +22,8 @@
 
 #include <boost/process/config.hpp>
 
-namespace boost
-{
-namespace process
-{
+namespace boost {
+namespace process {
 
 /*
  *

Modified: sandbox/SOC/2010/process/libs/process/example/child_stdin.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/child_stdin.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/child_stdin.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// creates a child process and writes synchronously
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/all/process.hpp>
 #include <string>
@@ -8,13 +18,11 @@
 
 int main()
 {
- std::string exe = find_executable_in_path("ftp");
- context ctx;
- // by default streams are inherited; if this process wants to write
- // to child's stdin the stream must be redirected (= captured)
- ctx.stdin_behavior = capture;
- child c = create_child(exe, ctx);
- postream &os = c.get_stdin();
- os << "quit" << std::endl;
+ std::string exe = find_executable_in_path("ftp");
+ context ctx;
+ ctx.stdin_behavior = stream_behavior::capture;
+ child c = create_child(exe, ctx);
+ postream &os = c.get_stdin();
+ os << "quit" << std::endl;
 }
 

Modified: sandbox/SOC/2010/process/libs/process/example/child_stdout.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/child_stdout.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/child_stdout.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// creates a child process and reads synchronously
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/all/process.hpp>
 #include <string>
@@ -8,13 +18,10 @@
 
 int main()
 {
- std::string exe = find_executable_in_path("hostname");
- context ctx;
- // by default streams are inherited; if this process wants to read
- // from child's stdout the stream must be redirected (= captured)
- ctx.stdout_behavior = capture;
- child c = create_child(exe, ctx);
- pistream &is = c.get_stdout();
- std::cout << is.rdbuf();
+ std::string exe = find_executable_in_path("hostname");
+ context ctx;
+ ctx.stdout_behavior = stream_behavior::capture;
+ child c = create_child(exe, ctx);
+ pistream &is = c.get_stdout();
+ std::cout << is.rdbuf();
 }
-

Modified: sandbox/SOC/2010/process/libs/process/example/create_process.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/create_process.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/create_process.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,35 +1,36 @@
-/*
- * Creating process with child_create()
- */
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
-#include <boost/process.hpp>
-#include <vector>
+#include <boost/process/all.hpp>
 #include <iostream>
+#include <vector>
+#include <string>
+#include <utility>
 
 using namespace boost::process;
 
 int main()
-{
- //simple usage
- child c1 = create_child( find_executable_in_path("hostname") );
-
- //usage with arguments
- std::vector<std::string> args;
-
- args.push_back("-a");
- args.push_back("-a");
- child c2 = create_child(find_executable_in_path("hostname"), args);
+{
+ child c1 = create_child(find_executable_in_path("hostname"));
 
- //complete usage
- struct context ctx;
- ctx.environment.insert(std::make_pair("NEW_ENV_VARIABLE", "VALUE"));
- ctx.process_name = "My_process_name";
- ctx.stdin_behavior = inherit;
- ctx.stdout_behavior = closed;
- ctx.stderr_behavior = closed;
-
- child c3 = create_child(find_executable_in_path("hostname"), args,ctx);
-
- return 0;
+ std::vector<std::string> args;
+ args.push_back("-?");
+ child c2 = create_child(find_executable_in_path("hostname"), args);
+
+ context ctx;
+ ctx.environment.insert(std::make_pair("NEW_ENV_VARIABLE", "VALUE"));
+ ctx.process_name = "My_process_name";
+ ctx.stdin_behavior = stream_behavior::inherit;
+ ctx.stdout_behavior = stream_behavior::closed;
+ ctx.stderr_behavior = stream_behavior::closed;
+ child c3 = create_child(find_executable_in_path("hostname"), args, ctx);
 }
-

Modified: sandbox/SOC/2010/process/libs/process/example/process_factory.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/process_factory.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/process_factory.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// creates a child process using the high-level API
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/process/all.hpp>
 #include <boost/assign/list_of.hpp>
@@ -9,8 +19,7 @@
 
 int main()
 {
- process_factory f("C:\\Windows\\notepad.exe");
- f.environment.insert(std::make_pair("NEW_ENV_VARIABLE", "VALUE"));
- child = f.create();
+ process_factory f("C:\\Windows\\notepad.exe");
+ f.environment.insert(std::make_pair("NEW_ENV_VARIABLE", "VALUE"));
+ child = f.create();
 }
-

Modified: sandbox/SOC/2010/process/libs/process/example/read_async_from_child.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/read_async_from_child.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/read_async_from_child.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// creates a child process and reads asynchronously
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/all/process.hpp>
 #include <boost/asio.hpp>
@@ -19,32 +29,25 @@
 
 int main()
 {
- std::string exe = find_executable_in_path("hostname");
- context ctx;
- // if we want to use asynchronous I/O we must pass a pointer to an
- // I/O service object; the I/O service object is used to initialize
- // I/O objects of type pistream and postream within the child object
- ctx.io_service = &ioservice;
- // by default streams are inherited; if this process wants to read
- // from child's stdout the stream must be redirected (= captured)
- ctx.stdout_behavior = capture;
- child c = create_child(exe, ctx);
- is = &c.get_stdout();
- begin_read();
- ioservice.run();
+ std::string exe = find_executable_in_path("hostname");
+ context ctx;
+ ctx.stdout_behavior = stream_behavior::capture;
+ child c = create_child(exe, ctx);
+ is = &c.get_stdout();
+ begin_read();
+ ioservice.run();
 }
 
 void begin_read()
 {
- is->async_read_some(buffer(buf), boost::bind(&end_read, placeholders::error, placeholders::bytes_transferred));
+ is->async_read_some(buffer(buf), boost::bind(&end_read, placeholders::error, placeholders::bytes_transferred));
 }
 
 void end_read(const boost::system::error_code &ec, std::size_t bytes_transferred)
 {
- if (!ec)
- {
- std::cout << std::string(buf.data(), bytes_transferred) << std::flush;
- begin_read();
- }
+ if (!ec)
+ {
+ std::cout << std::string(buf.data(), bytes_transferred) << std::flush;
+ begin_read();
+ }
 }
-

Modified: sandbox/SOC/2010/process/libs/process/example/read_async_from_parent.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/read_async_from_parent.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/read_async_from_parent.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// read asynchronously to parent process (suppose this program is always started as a child process)
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/all/process.hpp>
 #include <boost/asio.hpp>
@@ -13,20 +23,13 @@
 
 int main()
 {
- // Boris: ctx.io_service doesn't make much sense; or are there any other
- // context settings to configure for a parent?
- //
- // Felipe: Maybe as a member of parent?
-
- parent p(ioservice);
- String buffer;
- pistream &is = p.get_stdout();
-
- async_read(os, &buffer, boost::bind(&end_read, placeholders::error));
- ioservice.run();
+ parent p(ioservice);
+ std::string buffer;
+ pistream &is = p.get_stdout();
+ async_read(os, &buffer, boost::bind(&end_read, placeholders::error));
+ ioservice.run();
 }
 
 void end_read(const boost::system::error_code &ec)
 {
 }
-

Modified: sandbox/SOC/2010/process/libs/process/example/read_from_child.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/read_from_child.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/read_from_child.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// creates a child process and reads synchronously
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/all/process.hpp>
 #include <string>
@@ -8,9 +18,8 @@
 
 int main()
 {
- std::string exe = find_executable_in_path("hostname");
- child c = create_child(exe);
- pistream &is = c.get_stdout();
- std::cout << is.rdbuf();
+ std::string exe = find_executable_in_path("hostname");
+ child c = create_child(exe);
+ pistream &is = c.get_stdout();
+ std::cout << is.rdbuf();
 }
-

Modified: sandbox/SOC/2010/process/libs/process/example/read_from_parent.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/read_from_parent.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/read_from_parent.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// reads synchronously from parent process (suppose this program is always started as a child process)
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/all/process.hpp>
 #include <iostream>
@@ -7,8 +17,7 @@
 
 int main()
 {
- parent p;
- pistream &is = p.get_stdout();
- std::cout << is.rdbuf();
+ parent p;
+ pistream &is = p.get_stdout();
+ std::cout << is.rdbuf();
 }
-

Modified: sandbox/SOC/2010/process/libs/process/example/read_info_from_process.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/read_info_from_process.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/read_info_from_process.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// access unrelated processes and read an attribute
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/process/all.hpp>
 #include <boost/foreach.hpp>
@@ -10,16 +20,12 @@
 
 int main()
 {
- std::vector<process> processes;
+ std::vector<process> processes;
 
- options opts;
- opts.children_only = true;
- // without any option the snapshot contains all processes;
- // if and how many options Boost.Process is going to support
- // depends on how much time there is to implement them
- create_snapshot(std::back_inserter(processes), opts);
+ options opts;
+ opts.children_only = true;
+ create_snapshot(std::back_inserter(processes), opts);
 
- BOOST_FOREACH(process &p, processes)
- std::cout << p.name() << std::endl;
+ BOOST_FOREACH(process &p, processes)
+ std::cout << p.name() << std::endl;
 }
-

Modified: sandbox/SOC/2010/process/libs/process/example/terminate_child.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/terminate_child.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/terminate_child.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// creates a child and terminates it
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/all/process.hpp>
 #include <string>
@@ -7,9 +17,7 @@
 
 int main()
 {
- std::string exe = find_executable_in_path("hostname");
- child c = create_child(exe);
- c.terminate();
+ std::string exe = find_executable_in_path("hostname");
+ child c = create_child(exe);
+ c.terminate();
 }
-
-

Modified: sandbox/SOC/2010/process/libs/process/example/wait_async_child.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/wait_async_child.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/wait_async_child.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// creates a child process and reads asynchronously
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/all/process.hpp>
 #include <boost/asio.hpp>
@@ -19,27 +29,25 @@
 
 int main()
 {
- std::string exe = find_executable_in_path("hostname");
- context ctx;
- ctx.io_service = &ioservice;
- child c = create_child(exe, ctx);
- is = &c.get_stdout();
- begin_read();
- ioservice.run();
+ std::string exe = find_executable_in_path("hostname");
+ context ctx;
+ ctx.io_service = &ioservice;
+ child c = create_child(exe, ctx);
+ is = &c.get_stdout();
+ begin_read();
+ ioservice.run();
 }
 
 void begin_read()
 {
- is->async_read_some(buffer(buf), boost::bind(&end_read, placeholders::error, placeholders::bytes_transferred));
+ is->async_read_some(buffer(buf), boost::bind(&end_read, placeholders::error, placeholders::bytes_transferred));
 }
 
 void end_read(const boost::system::error_code &ec, std::size_t bytes_transferred)
 {
- if (!ec)
- {
- std::cout << std::string(buf.data(), bytes_transferred) << std::flush;
- begin_read();
- }
+ if (!ec)
+ {
+ std::cout << std::string(buf.data(), bytes_transferred) << std::flush;
+ begin_read();
+ }
 }
-
-

Modified: sandbox/SOC/2010/process/libs/process/example/wait_async_process.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/wait_async_process.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/wait_async_process.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// access an unrelated process and wait asynchronously
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/process/all.hpp>
 #include <boost/asio.hpp>
@@ -17,20 +27,16 @@
 
 int main()
 {
- std::vector<process> processes;
- create_snapshot(std::back_inserter(processes));
- process p = processes.front();
- // if status is an I/O object it must be bound to an I/O service object;
- // we pass ioservice as a parameter to bind the status object which is
- // created within the status() method to the I/O service object;
- status &s = p.status(ioservice);
- s.async_wait(boost::bind(&end_wait, placeholders::error));
- ioservice.run();
+ std::vector<process> processes;
+ create_snapshot(std::back_inserter(processes));
+ process p = processes.front();
+ status &s = p.status(ioservice);
+ s.async_wait(boost::bind(&end_wait, placeholders::error));
+ ioservice.run();
 }
 
 void end_wait(const boost::system::error_code &ec)
 {
- if (!ec)
- std::cout << "process exited" << std::endl;
+ if (!ec)
+ std::cout << "process exited" << std::endl;
 }
-

Modified: sandbox/SOC/2010/process/libs/process/example/wait_child.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/wait_child.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/wait_child.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// creates a child process and waits synchronously
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/process/all.hpp>
 #include <string>
@@ -8,10 +18,9 @@
 
 int main()
 {
- std::string exe = find_executable_in_path("hostname");
- child c = create_child(exe);
- status s = c.wait();
- if (s.exited())
- std::cout << s.exit_code() << std::endl;
+ std::string exe = find_executable_in_path("hostname");
+ child c = create_child(exe);
+ status s = c.wait();
+ if (s.exited())
+ std::cout << s.exit_code() << std::endl;
 }
-

Modified: sandbox/SOC/2010/process/libs/process/example/wait_process.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/wait_process.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/wait_process.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// access an unrelated process and wait synchronously
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/process/all.hpp>
 #include <vector>
@@ -9,11 +19,10 @@
 
 int main()
 {
- std::vector<process> processes;
- create_snapshot(std::back_inserter(processes));
- process p = processes.front();
- status s = p.wait();
- if (s.exited())
- std::cout << s.exit_code() << std::endl;
+ std::vector<process> processes;
+ create_snapshot(std::back_inserter(processes));
+ process p = processes.front();
+ status s = p.wait();
+ if (s.exited())
+ std::cout << s.exit_code() << std::endl;
 }
-

Modified: sandbox/SOC/2010/process/libs/process/example/write_async_to_child.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/write_async_to_child.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/write_async_to_child.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// creates a child process and writes asynchronously
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/all/process.hpp>
 #include <boost/asio.hpp>
@@ -15,22 +25,15 @@
 
 int main()
 {
- std::string exe = find_executable_in_path("ftp");
- context ctx;
- // if we want to use asynchronous I/O we must pass a pointer to an
- // I/O service object; the I/O service object is used to initialize
- // I/O objects of type pistream and postream within the child object
- context.io_service = &ioservice;
- // by default streams are inherited; if this process wants to write
- // to child's stdin the stream must be redirected (= captured)
- ctx.stdin_behavior = capture;
- child c = create_child(exe, ctx);
- postream &os = c.get_stdin();
- async_write(os, buffer("quit\n"), boost::bind(&end_write, placeholders::error));
- ioservice.run();
+ std::string exe = find_executable_in_path("ftp");
+ context ctx;
+ ctx.stdin_behavior = stream_behavior::capture;
+ child c = create_child(exe, ctx);
+ postream &os = c.get_stdin();
+ async_write(os, buffer("quit\n"), boost::bind(&end_write, placeholders::error));
+ ioservice.run();
 }
 
 void end_write(const boost::system::error_code &ec)
 {
 }
-

Modified: sandbox/SOC/2010/process/libs/process/example/write_async_to_parent.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/write_async_to_parent.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/write_async_to_parent.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// write asynchronously to parent process (suppose this program is always started as a child process)
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/all/process.hpp>
 #include <boost/asio.hpp>
@@ -13,15 +23,12 @@
 
 int main()
 {
- // ctx.io_service doesn't make much sense; or are there any other
- // context settings to configure for a parent?
- parent p(ioservice);
- postream &os = p.get_stdin();
- async_write(os, buffer("Hello, world!"), boost::bind(&end_write, placeholders::error));
- ioservice.run();
+ parent p(ioservice);
+ postream &os = p.get_stdin();
+ async_write(os, buffer("Hello, world!"), boost::bind(&end_write, placeholders::error));
+ ioservice.run();
 }
 
 void end_write(const boost::system::error_code &ec)
 {
 }
-

Modified: sandbox/SOC/2010/process/libs/process/example/write_info_to_child.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/write_info_to_child.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/write_info_to_child.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// access child processes and write an attribute
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/process/all.hpp>
 #include <boost/foreach.hpp>
@@ -10,17 +20,11 @@
 
 int main()
 {
- std::vector<process> processes;
-
- options opts;
- opts.children_only = true;
- // without any option the snapshot contains all processes;
- // if and how many options Boost.Process is going to support
- // depends on how much time there is to implement them
- create_snapshot(std::back_inserter(processes), opts);
-
- BOOST_FOREACH(process &p, processes)
- p.set_priority(HIGH); //Not part of base plan
+ std::vector<process> processes;
+ options opts;
+ opts.children_only = true;
+ create_snapshot(std::back_inserter(processes), opts);
 
+ BOOST_FOREACH(process &p, processes)
+ p.set_priority(HIGH);
 }
-

Modified: sandbox/SOC/2010/process/libs/process/example/write_info_to_self.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/write_info_to_self.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/write_info_to_self.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// access child processes and write an attribute
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/process/all.hpp>
 #include <iostream>
@@ -7,9 +17,6 @@
 
 int main()
 {
-
- self &s = self::get_instance();
- s.set_priority(HIGH); //implement latter?
-
+ self &s = self::get_instance();
+ s.set_priority(HIGH);
 }
-

Modified: sandbox/SOC/2010/process/libs/process/example/write_to_child.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/write_to_child.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/write_to_child.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// creates a child process and writes synchronously
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/all/process.hpp>
 #include <string>
@@ -8,13 +18,10 @@
 
 int main()
 {
- std::string exe = find_executable_in_path("ftp");
- context ctx;
- // by default streams are inherited; if this process wants to write
- // to child's stdin the stream must be redirected (= captured)
- ctx.stdin_behavior = capture;
- child c = create_child(exe, ctx);
- postream &os = c.get_stdin();
- os << "quit" << std::endl;
+ std::string exe = find_executable_in_path("ftp");
+ context ctx;
+ ctx.stdin_behavior = stream_behavior::capture;
+ child c = create_child(exe, ctx);
+ postream &os = c.get_stdin();
+ os << "quit" << std::endl;
 }
-

Modified: sandbox/SOC/2010/process/libs/process/example/write_to_parent.cpp
==============================================================================
--- sandbox/SOC/2010/process/libs/process/example/write_to_parent.cpp (original)
+++ sandbox/SOC/2010/process/libs/process/example/write_to_parent.cpp 2010-06-03 18:40:43 EDT (Thu, 03 Jun 2010)
@@ -1,4 +1,14 @@
-// write synchronously to parent process (suppose this program is always started as a child process)
+//
+// Boost.Process
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal
+// Copyright (c) 2008, 2009 Boris Schaeling
+// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
 
 #include <boost/all/process.hpp>
 
@@ -6,8 +16,7 @@
 
 int main()
 {
- parent p;
- postream &os = p.get_stdin();
- os << "Hello, world!" << std::endl;
+ parent p;
+ postream &os = p.get_stdin();
+ os << "Hello, world!" << std::endl;
 }
-


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