Skip to content

Commit 9227e00

Browse files
committed
Added additional detection for windows consoles
1 parent 4f5dad1 commit 9227e00

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/ngscopeclient/main.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,16 @@ int main(int argc, char* argv[])
7272
//If on Windows, and not run from a console
7373
//remove the stdout log sink that would otherwise spawn a console on startup
7474
#ifdef _WIN32
75-
if(getenv("PROMPT") != nullptr)
76-
LogDebug("Startup: skipping stdout log sink since not run from a console\n");
75+
if(GetConsoleWindow()) == NULL)
76+
LogNotice("Startup: skipping stdout log sink since not run from a console (no console window)\n");
77+
else if(getenv("PROMPT") != nullptr)
78+
LogNotice("Startup: skipping stdout log sink since not run from a console (no prompt)\n");
7779
else
7880
{
7981
#endif
8082
g_log_sinks.push_back(make_unique<ColoredSTDLogSink>(console_verbosity));
8183
#ifdef _WIN32
82-
LogDebug("Startup: run from a console, keeping stdout log sink attached\n");
84+
LogNotice("Startup: run from a console, keeping stdout log sink attached\n");
8385
}
8486
#endif
8587

0 commit comments

Comments
 (0)