[c-host] windows: don't attach to the debuggers console

This commit is contained in:
Geoffrey McRae 2019-12-13 23:33:11 +11:00
parent e75f3a7278
commit 2d9f578719

View File

@ -160,7 +160,7 @@ static BOOL WINAPI CtrlHandler(DWORD dwCtrlType)
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
/* this is a bit of a hack but without this --help will produce no output in a windows command prompt */
if (AttachConsole(ATTACH_PARENT_PROCESS))
if (!IsDebuggerPresent() && AttachConsole(ATTACH_PARENT_PROCESS))
{
HANDLE std_err = GetStdHandle(STD_ERROR_HANDLE);
HANDLE std_out = GetStdHandle(STD_OUTPUT_HANDLE);