Move console attachment to main and only perform if running in a terminal. (!102)
This commit is contained in:
parent
8168e1cadb
commit
8667211180
2 changed files with 14 additions and 10 deletions
14
main.cpp
14
main.cpp
|
|
@ -127,6 +127,20 @@ bool AttemptLocalConnection(std::vector<RGBController*> &rgb_controllers)
|
|||
int main(int argc, char* argv[])
|
||||
{
|
||||
#ifdef _WIN32
|
||||
/*---------------------------------------------------------*\
|
||||
| Windows only - Attach console output |
|
||||
\*---------------------------------------------------------*/
|
||||
if (AttachConsole(ATTACH_PARENT_PROCESS))
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| We are running under some terminal context; otherwise |
|
||||
| leave the GUI and CRT alone |
|
||||
\*---------------------------------------------------------*/
|
||||
freopen("CONIN$", "r", stdin);
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
freopen("CONOUT$", "w", stderr);
|
||||
}
|
||||
|
||||
std::thread * InitializeTimerResolutionThread;
|
||||
InitializeTimerResolutionThread = new std::thread(InitializeTimerResolutionThreadFunction);
|
||||
InitializeTimerResolutionThread->detach();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue