Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
zed: Attach console to parent process before processing `--printenv` (#42075)
Lukas Wirth3b7ee58cfaa5
diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rsindex 18903d88809..e3fb37b9026 100644--- a/crates/zed/src/main.rs+++ b/crates/zed/src/main.rs@@ -190,6 +190,15 @@ pub fn main() {}}+ #[cfg(all(not(debug_assertions), target_os = "windows"))]+ unsafe {+ use windows::Win32::System::Console::{ATTACH_PARENT_PROCESS, AttachConsole};++ if args.foreground {+ let _ = AttachConsole(ATTACH_PARENT_PROCESS);+ }+ }+// `zed --printenv` Outputs environment variables as JSON to stdoutif args.printenv {util::shell_env::print_env();@@ -206,15 +215,6 @@ pub fn main() {paths::set_custom_data_dir(dir);}- #[cfg(all(not(debug_assertions), target_os = "windows"))]- unsafe {- use windows::Win32::System::Console::{ATTACH_PARENT_PROCESS, AttachConsole};-- if args.foreground {- let _ = AttachConsole(ATTACH_PARENT_PROCESS);- }- }-#[cfg(target_os = "windows")]match util::get_zed_cli_path() {Ok(path) => askpass::set_askpass_program(path),