# # patch "netxx_pipe.cc" # from [4f3d35be8b18b51086c6255e0501a047e379a2e7] # to [13382004adce903aefb4b95c8f4a159e99391cdc] # ======================================================================== --- netxx_pipe.cc 4f3d35be8b18b51086c6255e0501a047e379a2e7 +++ netxx_pipe.cc 13382004adce903aefb4b95c8f4a159e99391cdc @@ -111,11 +111,7 @@ siStartInfo.dwFlags |= STARTF_USESTDHANDLES; // unfortunately munge_argv_into_cmdline does not take a vector // as its argument - I(args.size()<(sizeof(argv)/sizeof(argv[0]))); - for (std::vector::const_iterator i=args.begin();i!=args.end();++i,++pos) - argv[pos]=i->c_str(); - argv[pos]=0; - std::string cmdline=munge_argv_into_cmdline(argv); + std::string cmdline=munge_argv_into_cmdline(newargv); L(F("cmdline '%s'\n") % cmdline); FAIL_IF(CreateProcess,(0,const_cast(cmdline.c_str()), 0,0,TRUE,0,0,0,&siStartInfo,&piProcInfo),==0); @@ -219,8 +215,13 @@ FAIL_IF( ReadFile,(h_read,pipe->readbuf,1,&bytes_read,&pipe->overlap),==0); if (!bytes_read) { - FAIL_IF( WaitForSingleObject,(pipe->overlap.hEvent,timeout.get_sec()),==WAIT_FAILED); + int seconds=timeout.get_sec(); + // WaitForSingleObject is inaccurate + if (!seconds && timeout.get_usec()) seconds=1; + L(F("WaitForSingleObject(,%d)\n") % seconds); + FAIL_IF( WaitForSingleObject,(pipe->overlap.hEvent,seconds),==WAIT_FAILED); FAIL_IF( GetOverlappedResult,(h_read,&pipe->overlap,&bytes_read,FALSE),==0); + L(F("GetOverlappedResult(,,%d,)\n") % bytes_read); if (!bytes_read) { FAIL_IF( CancelIo,(h_read),==0); @@ -229,7 +230,9 @@ } I(bytes_read==1); pipe->bytes_available=bytes_read; + L(F("ReadFile\n")); FAIL_IF( ReadFile,(h_read,pipe->readbuf+1,sizeof pipe->readbuf-1,&bytes_read,&pipe->overlap),==0); + L(F("CancelIo\n")); FAIL_IF( CancelIo,(h_read),==0); if (!bytes_read) {