From 22220ed32e1eb4fe5e4ec8f3f0a0f6dc3cd0e871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=B0=8F=E7=99=BD?= <364772080@qq.com> Date: Fri, 28 Feb 2025 19:05:39 +0800 Subject: [PATCH] windows: Remove unnecessary code in #25412 (#25805) Closes #ISSUE Release Notes: - N/A *or* Added/Fixed/Improved ... --- crates/zed/src/main.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index a66f298f3925f4d50bae5ae6ee1bc2b363f32791..ce898b33a037214e86e64c0d5a526bde4bf730a6 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -171,17 +171,12 @@ fn fail_to_open_window(e: anyhow::Error, _cx: &mut App) { fn main() { let args = Args::parse(); - #[cfg(target_os = "windows")] - let run_foreground = args.foreground; - #[cfg(all(not(debug_assertions), target_os = "windows"))] - if run_foreground { - unsafe { - use windows::Win32::System::Console::{AttachConsole, ATTACH_PARENT_PROCESS}; + unsafe { + use windows::Win32::System::Console::{AttachConsole, ATTACH_PARENT_PROCESS}; - if run_foreground { - let _ = AttachConsole(ATTACH_PARENT_PROCESS); - } + if args.foreground { + let _ = AttachConsole(ATTACH_PARENT_PROCESS); } } @@ -235,7 +230,7 @@ fn main() { { !crate::zed::windows_only_instance::check_single_instance( open_listener.clone(), - run_foreground, + args.foreground, ) }