@@ -254,21 +254,21 @@ namespace core
254254 }
255255
256256 // ////////////////////////////////////////////////////////////////////////
257- static void ReadContextFromPipe (HANDLE hStdOut, std::tstring & strOutput)
257+ static void ReadContextFromPipe (HANDLE hStdOut, std::string & strOutput)
258258 {
259259 DWORD dwAvail = 0 ;
260260 while (::PeekNamedPipe (hStdOut, NULL , 0 , NULL , &dwAvail, NULL ))
261261 {
262262 if (0 == dwAvail)
263- return ;
263+ break ;
264264
265265 const DWORD dwBuffSize = 32 ;
266266 char szBuffer[dwBuffSize + 1 ];
267267
268268 DWORD dwReadSize = 0 ;
269269 ReadFile (hStdOut, szBuffer, MIN (dwAvail, dwBuffSize), &dwReadSize);
270270 szBuffer[dwReadSize] = 0 ;
271- strOutput += TCSFromMBS ( szBuffer) ;
271+ strOutput += szBuffer;
272272 }
273273 }
274274
@@ -305,9 +305,11 @@ namespace core
305305 if (!::CreateProcess (NULL , (LPTSTR)strCmdLine.c_str (), NULL , NULL , TRUE , 0 , NULL , NULL , &stStartupInfo, &stProcessInfo))
306306 throw exception_format (TEXT (" Failed to CreateProcess(%s)" ), strCmdLine.c_str ());
307307
308+ std::string strTempOutput;
308309 while (WAIT_TIMEOUT == ::WaitForSingleObject (stProcessInfo.hProcess , 100 ))
309- ReadContextFromPipe (hStdOutPair[0 ], strOutput);
310- ReadContextFromPipe (hStdOutPair[0 ], strOutput);
310+ ReadContextFromPipe (hStdOutPair[0 ], strTempOutput);
311+ ReadContextFromPipe (hStdOutPair[0 ], strTempOutput);
312+ strOutput = TCSFromMBS (strTempOutput);
311313
312314 if (!GetExitCodeProcess (stProcessInfo.hProcess , &dwExitCode))
313315 Log_Warn (TEXT (" GetExitCodeProcess failure." ));
0 commit comments