[platform] launcher: making console attaching problems non-fatal

GitOrigin-RevId: b991b376565ec30a4dde14984c8c7044dd8af6b0
This commit is contained in:
Roman Shevchenko
2024-06-18 14:56:16 +02:00
committed by intellij-monorepo-bot
parent 2a9d94c3e5
commit 6c5874feea

View File

@@ -91,9 +91,11 @@ pub fn main_lib() {
#[cfg(target_os = "windows")]
fn attach_console() {
unsafe {
match AttachConsole(ATTACH_PARENT_PROCESS) {
Ok(_) => {}
Err(_) => AllocConsole().expect("Failed to attach to existing console or allocate a new one")
if AttachConsole(ATTACH_PARENT_PROCESS).is_err() {
eprintln!("AttachConsole(ATTACH_PARENT_PROCESS): {:?}", Foundation::GetLastError());
if AllocConsole().is_err() {
eprintln!("AllocConsole(): {:?}", Foundation::GetLastError());
}
}
}
}