# # patch "netxx_pipe.cc" # from [f7e10a38ebba9f28e8400481447029b0383f7ef6] # to [ccd8403fd64a79c3c893e18eac8625ca63c1bfd7] # ======================================================================== --- netxx_pipe.cc f7e10a38ebba9f28e8400481447029b0383f7ef6 +++ netxx_pipe.cc ccd8403fd64a79c3c893e18eac8625ca63c1bfd7 @@ -101,7 +101,7 @@ // yes, since we have to use named pipes because of nonblocking read // (so called overlapped I/O) we could as well use one bidirectional // pipe. I prefer two pipes to resemble the unix case. - snprintf(pipename,sizeof pipename,"\\\\.\\pipe\\netxx_pipe_%d_%d", + snprintf(pipename,sizeof pipename,"\\\\.\\pipe\\netxx_pipe_%ld_%d", GetCurrentProcessId(),++serial); HANDLE readhandle=0,writehandle=0; FAIL_IF(readhandle=CreateNamedPipe,(pipename, @@ -117,6 +117,7 @@ // mark these file handles as not inheritable SetHandleInformation( (HANDLE)_get_osfhandle(fd1[0]), HANDLE_FLAG_INHERIT, 0); SetHandleInformation( (HANDLE)_get_osfhandle(fd2[1]), HANDLE_FLAG_INHERIT, 0); + SetHandleInformation( (HANDLE)_get_osfhandle(fd2[0]), HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT); // set up the child with the pipes as stdin/stdout and inheriting stderr PROCESS_INFORMATION piProcInfo; STARTUPINFO siStartInfo; @@ -139,7 +140,7 @@ // create infrastructure for overlapping I/O memset(&overlap,0,sizeof overlap); - overlap.hEvent=CreateEvent(0,FALSE,FALSE,0); // or TRUE,TRUE? + overlap.hEvent=CreateEvent(0,TRUE,TRUE,0); // FALSE,FALSE,0); // or TRUE,TRUE? bytes_available=0; I(overlap.hEvent!=0); #else @@ -340,7 +341,8 @@ static void simple_pipe_test() -{ +{ try + { Netxx::PipeStream pipe("cat",std::vector()); std::string result; @@ -384,6 +386,11 @@ I((unsigned char)(result[1])==255-c); } pipe.close(); + } catch (informative_failure &e) // for some reason boost does not provide + // enough information + { W(F("Failure %s\n") % e.what); + throw; + } } void