Disable batch-file workaround for !makensis command

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6763 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2016-07-06 11:28:48 +00:00
parent 73c00e3718
commit e6a1780485
3 changed files with 10 additions and 13 deletions

View file

@ -3195,7 +3195,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
const TCHAR *cmdname=get_commandtoken_name(which_token);
const TCHAR *exec=line.gettoken_str(1), *define=0;
int comp=line.gettoken_enum(2,_T("<\0>\0<>\0=\0ignore\0"));
int validparams=true, ret=-1, cmpv=0;
int validparams=true, ret=-1, cmpv=0, forceutf8=0;
switch(line.getnumtokens()-1)
{
case 1: comp=4; break;
@ -3211,11 +3211,8 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
TCHAR buf[33];
compile=_T("\""), compile+=get_executable_path(g_argv0), compile+= _T("\"");
compile+= _T(" ") OPT_STR _T("v"), wsprintf(buf,_T("%d"),get_verbosity()), compile+=buf;
#ifdef _WIN32 // POSIX does not support -OUTPUTCHARSET
extern NStreamEncoding g_outputenc;
NStreamEncoding childenc=g_outputenc;
if (childenc.IsUnicode()) childenc.SetCodepage(NStreamEncoding::UTF8); // UTF-8 is the only Unicode encoding supported by RunChildProcessRedirected
compile+= _T(" ") OPT_STR _T("OCS "), childenc.GetCPDisplayName(buf), compile+=buf;
#if defined(_WIN32) && defined(_UNICODE) // POSIX does not support -OUTPUTCHARSET
compile+= _T(" ") OPT_STR _T("OCS UTF8"), forceutf8++; // Force UTF-8 and disable batch-file workaround in RunChildProcessRedirected
#endif
if (*exec) compile+= _T(" "), compile+=exec;
exec=compile.c_str();
@ -3224,7 +3221,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
if (preprocessonly) PREPROCESSONLY_BEGINCOMMENT();
#ifdef _WIN32
if (TOK_P_SYSTEMEXEC != which_token)
ret=RunChildProcessRedirected(exec);
ret=RunChildProcessRedirected(exec, forceutf8 ? true : false);
else
#endif //~ _WIN32
ret=sane_system(exec);

View file

@ -848,7 +848,7 @@ const TCHAR* GetFriendlySize(UINT64 n, unsigned int&fn, GETFRIENDLYSIZEFLAGS f)
#ifdef _WIN32
#ifdef _UNICODE
int RunChildProcessRedirected(LPCWSTR cmdprefix, LPCWSTR cmdmain)
int RunChildProcessRedirected(LPCWSTR cmdprefix, LPCWSTR cmdmain, bool ForceUTF8)
{
// We have to deliver the requested output encoding to our host (if any) and the
// only way to do that is to convert the pipe content from what we hope is UTF-8.
@ -865,7 +865,7 @@ int RunChildProcessRedirected(LPCWSTR cmdprefix, LPCWSTR cmdmain)
SECURITY_DESCRIPTOR sd = { 1, 0, SE_DACL_PRESENT, NULL, };
SECURITY_ATTRIBUTES sa = { sizeof(sa), &sd, TRUE };
const UINT orgwinconcp = GetConsoleCP(), orgwinconoutcp = GetConsoleOutputCP();
if (orgwinconoutcp == oemcp) cp = oemcp, mbtwcf = 0; // Bug #1092: Batch files not a fan of UTF-8
if (orgwinconoutcp == oemcp && !ForceUTF8) cp = oemcp, mbtwcf = 0; // Bug #1092: Batch files not a fan of UTF-8
HANDLE hSIRd, hSIWr, hSORd, hSOWr;
PROCESS_INFORMATION pi;
if (!CreatePipe(&hSIRd, &hSIWr, &sa, 0)) // XCopy.exe does not work without a valid StdIn!
@ -961,7 +961,7 @@ switchcp: cp = orgwinconoutcp, mbtwcf = 0, utf8 = false;
return childec;
}
#else
int RunChildProcessRedirected(LPCSTR cmd)
int RunChildProcessRedirected(LPCSTR cmd, bool ForceUTF8)
{
STARTUPINFO si = { sizeof(STARTUPINFO), };
PROCESS_INFORMATION pi;

View file

@ -109,8 +109,8 @@ void PrintColorFmtMsg(unsigned int type, const TCHAR *fmtstr, va_list args);
void FlushOutputAndResetPrintColor();
#ifdef _WIN32
#ifdef _UNICODE
int RunChildProcessRedirected(LPCWSTR cmdprefix, LPCWSTR cmdmain);
inline int RunChildProcessRedirected(LPCWSTR cmd) { return RunChildProcessRedirected(0, cmd); }
int RunChildProcessRedirected(LPCWSTR cmdprefix, LPCWSTR cmdmain, bool ForceUTF8 = false);
inline int RunChildProcessRedirected(LPCWSTR cmd, bool ForceUTF8 = false) { return RunChildProcessRedirected(0, cmd, ForceUTF8); }
#ifdef MAKENSIS
typedef struct {
HANDLE hNative;
@ -140,7 +140,7 @@ int WinStdIO_wprintf(const wchar_t*Fmt, ...);
#define _vftprintf WinStdIO_vfwprintf
#endif // ~MAKENSIS
#else
int RunChildProcessRedirected(LPCSTR cmd);
int RunChildProcessRedirected(LPCSTR cmd, bool ForceUTF8 = false);
#endif // ~_UNICODE
#define ResetPrintColor() FlushOutputAndResetPrintColor() // For reset ONLY, use PrintColorFmtMsg(0,NULL ...
#define SetPrintColorWARN() PrintColorFmtMsg(1|0x10, NULL, (va_list)NULL)