From 39de85be706da6cf44296d417464b968772dc3d8 Mon Sep 17 00:00:00 2001 From: anders_k Date: Tue, 24 Oct 2017 13:19:00 +0000 Subject: [PATCH] Make sure !system outputs whatever is left in the pipe even if there is no newline git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6940 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/util.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/util.cpp b/Source/util.cpp index 66f1e5f1..015d1a24 100644 --- a/Source/util.cpp +++ b/Source/util.cpp @@ -1069,7 +1069,7 @@ switchcp: cp = orgwinconoutcp, mbtwcf = 0, utf8 = false; if (--cch) wbuf[cchwb++] = wchbuf[1]; const bool fullbuf = cchwb+cch >= COUNTOF(wbuf)-1; // cch is 1 for surrogate pairs if (!okr || fullbuf || L'\n' == wchbuf[0]) // Stop on \n so \r\n conversion has enough context (...\r\n vs ...\n) - { + { finalwrite: #ifdef MAKENSIS extern WINSIO_OSDATA g_osdata_stdout; WinStdIO_OStreamWrite(g_osdata_stdout, wbuf, cchwb); // Faster than _ftprintf @@ -1080,8 +1080,13 @@ switchcp: cp = orgwinconoutcp, mbtwcf = 0, utf8 = false; cchwb = 0; } } - if (!okr) break; + if (!okr) + { + if (cchwb) goto finalwrite; + break; + } } + fflush(g_output); WaitForSingleObject(pi.hProcess, INFINITE); GetExitCodeProcess(pi.hProcess, &childec); CloseHandle(pi.hThread);