fix linux console crash, comment code out until someone figures out a more proper fix
Some checks failed
Build Binaries / Build Windows (push) Waiting to run
Build Binaries / Build macOS (push) Waiting to run
Build Binaries / Build Android (64-bit) (push) Waiting to run
Build Binaries / Build Android (32-bit) (push) Waiting to run
Build Binaries / Publish (push) Blocked by required conditions
Check CHANGELOG.md / Check CHANGELOG.md (push) Has been cancelled

This commit is contained in:
dankmeme01 2024-10-01 19:51:30 +02:00
parent 47e0ca52b6
commit 8ecb1c549a

View file

@ -115,19 +115,19 @@ void console::setup() {
path = std::string(buf, count - 1);
}
// count == 0 => not a console and not a file, assume it's closed
// wine does something weird with /dev/null? not sure tbh but it's definitely up to no good
// TODO: the isWine check is pretty hacky but without it the game does not launch at all and i cba to figure it out rn
if ((count == 0 || path.ends_with("\\dev\\null"))) {
s_outHandle = nullptr;
CloseHandle(GetStdHandle(STD_OUTPUT_HANDLE));
CloseHandle(GetStdHandle(STD_INPUT_HANDLE));
CloseHandle(GetStdHandle(STD_ERROR_HANDLE));
FreeConsole();
SetStdHandle(STD_OUTPUT_HANDLE, nullptr);
SetStdHandle(STD_INPUT_HANDLE, nullptr);
SetStdHandle(STD_ERROR_HANDLE, nullptr);
}
// TODO: this code causes a crash when piping game's output somewhere (and in some other cases), so it's removed for now
// // count == 0 => not a console and not a file, assume it's closed
// // wine does something weird with /dev/null? not sure tbh but it's definitely up to no good
// if ((count == 0 || path.ends_with("\\dev\\null"))) {
// s_outHandle = nullptr;
// CloseHandle(GetStdHandle(STD_OUTPUT_HANDLE));
// CloseHandle(GetStdHandle(STD_INPUT_HANDLE));
// CloseHandle(GetStdHandle(STD_ERROR_HANDLE));
// FreeConsole();
// SetStdHandle(STD_OUTPUT_HANDLE, nullptr);
// SetStdHandle(STD_INPUT_HANDLE, nullptr);
// SetStdHandle(STD_ERROR_HANDLE, nullptr);
// }
}
// clion console supports escape codes but we can't query that because it's a named pipe