Skip to content

Commit a7cc3b9

Browse files
committed
Removed "-c" console option on Window
1 parent f8644a5 commit a7cc3b9

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
149149
- Deprecated: `serverinfo/subscribe`
150150
- Use `subscribe` / `unsubscribe` subcommands instead
151151
- Deprecated: DirectX grabber in favour of the new DXGI DDA grabber
152+
- Removed "-c" console option on Windows. Hyperion can be started via terminal to get the required console output
152153

153154
## [2.0.16](https://github.com/hyperion-project/hyperion.ng/releases/tag/2.0.16) - 2024-01
154155

src/hyperiond/console.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
#include <Windows.h>
22

3-
void openConsole(bool isShowConsole)
3+
bool openConsole(bool isShowConsole)
44
{
5-
if (AttachConsole(ATTACH_PARENT_PROCESS) || (isShowConsole && AllocConsole())) {
5+
if (AttachConsole(ATTACH_PARENT_PROCESS))
6+
{
67
FILE* fp;
78
freopen_s(&fp, "CONOUT$", "w", stdout);
89
freopen_s(&fp, "CONOUT$", "w", stderr);
910
SetConsoleTitle(TEXT("Hyperion"));
1011
SetConsoleOutputCP(CP_UTF8);
12+
return true;
1113
}
14+
return false;
1215
}

src/hyperiond/main.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ int main(int argc, char** argv)
167167
parser.process(*qApp);
168168

169169
#ifdef WIN32
170-
bool isShowConsole = parser.isSet(consoleOption);
171-
openConsole(isShowConsole);
170+
//Attach the output to an existing console if available
171+
openConsole(false);
172172
#endif
173173

174174
if (parser.isSet(versionOption))
@@ -494,14 +494,5 @@ int main(int argc, char** argv)
494494

495495
Info(log, "Application ended with code %d", exitCode);
496496

497-
#ifdef _WIN32
498-
if (parser.isSet(consoleOption))
499-
{
500-
system("pause");
501-
}
502-
#endif
503-
504-
Logger::deleteInstance();
505-
506497
return exitCode;
507498
}

0 commit comments

Comments
 (0)