Permalink
Browse files

Fixed bug 1933 - Just redirected childs process output to parent and …

…removed unused stuff.

Change-Id: I508f4d87ee33464ac54e0c5a847e3ecb749b033c
Reviewed-on: http://review.northscale.com/1623
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
  • Loading branch information...
1 parent 774369b commit 4d08340d2c17ca51e9ee7ff5a788674c8d5d315c @oleg-baulo oleg-baulo committed with alk Aug 5, 2010
Showing with 2 additions and 22 deletions.
  1. +2 −22 src/windows_adaptor.c
View
@@ -19,8 +19,6 @@ typedef struct ConfigType
static HANDLE g_child_std_in_rd;
static HANDLE g_child_std_in_wr;
-static HANDLE g_child_std_out_rd;
-static HANDLE g_child_std_out_wr;
static Config g_config;
static PROCESS_INFORMATION* g_pchild_proc_info;
@@ -55,16 +53,6 @@ int _tmain(int argc, CHAR *argv[]) {
saAttr.bInheritHandle = TRUE;
saAttr.lpSecurityDescriptor = NULL;
- // Create a pipe for the child process's STDOUT.
- if (!CreatePipe(&g_child_std_out_rd, &g_child_std_out_wr, &saAttr, 0)) {
- ErrorExit(TEXT("StdoutRd CreatePipe"));
- }
-
- // Ensure the read handle to the pipe for STDOUT is not inherited.
- if (!SetHandleInformation(g_child_std_out_rd, HANDLE_FLAG_INHERIT, 0)) {
- ErrorExit(TEXT("Stdout SetHandleInformation"));
- }
-
// Create a pipe for the child process's STDIN.
if (!CreatePipe(&g_child_std_in_rd, &g_child_std_in_wr, &saAttr, 0)) {
ErrorExit(TEXT("Stdin CreatePipe"));
@@ -122,16 +110,16 @@ BOOL CreateChildProcess(Config* pconfig) {
STARTUPINFOA start_info;
BOOL success = FALSE;
HANDLE parent_std_out = GetStdHandle(STD_OUTPUT_HANDLE);
+ HANDLE parent_std_err = GetStdHandle(STD_ERROR_HANDLE);
// Set up members of the PROCESS_INFORMATION structure.
pproc_info = calloc(1, sizeof(PROCESS_INFORMATION));
// Set up members of the _STARTUPINFOW structure.
// This structure specifies the STDIN and STDOUT handles for redirection.
-
ZeroMemory( &start_info, sizeof(STARTUPINFOA));
start_info.cb = sizeof(STARTUPINFOA);
- start_info.hStdError = g_child_std_out_wr;
+ start_info.hStdError = parent_std_err;
start_info.hStdOutput = parent_std_out;
start_info.hStdInput = g_child_std_in_rd;
start_info.dwFlags |= STARTF_USESTDHANDLES;
@@ -208,14 +196,6 @@ void TrackChildProcess(Config* pconfig) {
DWORD thread_id;
int ch;
- // Close the write end of the pipe before reading from the
- // read end of the pipe, to control child process execution.
- // The pipe is assumed to have enough buffer space to hold the
- // data the child process has already written to it.
- if (!CloseHandle(g_child_std_out_wr)) {
- ErrorExit(TEXT("StdOutWr CloseHandle"));
- }
-
// Create a thread
g_hchild_tracking_thread = CreateThread(
NULL, // default security attributes

0 comments on commit 4d08340

Please sign in to comment.