|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62192 - in sandbox/SOC/2010/process/boost/process: . detail
From: fotanus_at_[hidden]
Date: 2010-05-25 02:59:02
Author: fotanus
Date: 2010-05-25 02:59:01 EDT (Tue, 25 May 2010)
New Revision: 62192
URL: http://svn.boost.org/trac/boost/changeset/62192
Log:
Minor changes
Text files modified:
sandbox/SOC/2010/process/boost/process/detail/stream_detail.hpp | 2 +-
sandbox/SOC/2010/process/boost/process/detail/win32_helpers.hpp | 32 +++++---------------------------
sandbox/SOC/2010/process/boost/process/operations.hpp | 34 +++++++++++++++++-----------------
3 files changed, 23 insertions(+), 45 deletions(-)
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-05-25 02:59:01 EDT (Tue, 25 May 2010)
@@ -117,7 +117,7 @@
}
- std::cout << "Inicializado com: " << stream_handle << std::endl;
+
}
};
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-05-25 02:59:01 EDT (Tue, 25 May 2010)
@@ -140,7 +140,7 @@
* It recieves stream_detail from that stream and a STARTUPINFOA
* That will be stored the configuration.
*/
-void configure_win32_stream(stream_detail &sd, STARTUPINFOA *si){
+inline file_handle configure_win32_stream(stream_detail &sd){
file_handle return_handle;
@@ -149,8 +149,7 @@
break;
}
- case inherit:{
-
+ case inherit:{
return_handle = file_handle::win32_dup_std(sd.stream_handle, true);
break;
}
@@ -195,30 +194,9 @@
}
}
-
-
- file_handle h;
- if(return_handle.valid()){
- switch(sd.stream_type){
- case stdin_type:{
- (*si).hStdInput = return_handle.get();
- break;
- }
- case stdout_type:{
- (*si).hStdOutput = return_handle.get();
- WriteFile(si->hStdOutput , "Test1\n", 6, NULL, NULL);
- break;
- }
- case stderr_type:{
- (*si).hStdError = return_handle.get();
- break;
- }
-
- }
- }
- else{
- si->hStdError = INVALID_HANDLE_VALUE;
- }
+
+ return return_handle;
+
}
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-05-25 02:59:01 EDT (Tue, 25 May 2010)
@@ -24,7 +24,6 @@
#include <boost/process/detail/posix_helpers.hpp>
#include <stdlib.h>
#include <unistd.h>
- #include <semaphore.h>
#if defined(__CYGWIN__)
#include <boost/scoped_array.hpp>
#include <sys/cygwin.h>
@@ -235,13 +234,6 @@
#if defined(BOOST_POSIX_API)
- //TODO: do we need this semaphore?
- static sem_t * sem_stream_config;
-
- ::sem_unlink("boost_sem_stream_config");
- sem_stream_config = ::sem_open("boost_sem_stream_config",O_CREAT,511,0);
- BOOST_ASSERT( sem_stream_config != SEM_FAILED);
-
child::id_type pid = ::fork();
if (pid == -1){
@@ -257,7 +249,7 @@
detail::configure_posix_stream(stdin_stream);
detail::configure_posix_stream(stdout_stream);
detail::configure_posix_stream(stderr_stream);
- ::sem_post(sem_stream_config);
+
//execve call
std::pair<std::size_t, char**> argcv = detail::collection_to_posix_argv(args);
@@ -270,7 +262,7 @@
}
BOOST_ASSERT(pid > 0);
- ::sem_wait(sem_stream_config);
+
//adjust father pipes
if(ctx.stdin_behavior == capture){
@@ -307,6 +299,7 @@
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));
@@ -315,11 +308,19 @@
startup_info.dwFlags |= STARTF_USESTDHANDLES;
//configure std stream info for the child
- configure_win32_stream(stdin_stream, &startup_info);
- configure_win32_stream(stdout_stream, &startup_info);
- configure_win32_stream(stderr_stream, &startup_info);
+ //TODO: Find a better way to do it.
+ detail::file_handle fh;
+ fh = configure_win32_stream(stdin_stream);
+ startup_info.hStdInput = fh.get();
+
+ fh = configure_win32_stream(stdout_stream);
+ startup_info.hStdOutput = fh.get();
- WriteFile(startup_info.hStdOutput , "Test2\n", 6, NULL, NULL);
+ fh = configure_win32_stream(stderr_stream);
+ startup_info.hStdError = fh.get();
+
+
+
//define process info and create it
@@ -337,7 +338,7 @@
boost::shared_array<char> envstrs = detail::environment_to_win32_strings(ctx.environment);
-
+ WriteFile(startup_info.hStdOutput, "Test\n", 5, NULL, NULL);
//I dare you to understand this code at first look.
if ( ::CreateProcessA(exe.get(), cmdline.get(),
@@ -350,8 +351,7 @@
"boost::process::detail::win32_start: CreateProcess failed"));
- //is this necessary?
-
+ //is this necessary?
if (! ::CloseHandle(pi.hThread))
boost::throw_exception(
boost::system::system_error(boost::system::error_code(
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