zed: Attach console to parent process before processing --printenv (#42075)

Otherwise the `--printenv` flag will simply not work on windows

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Lukas Wirth
2025-11-06 09:47:54 +00:00
committed by GitHub
parent 32047bef93
commit 3b7ee58cfa
+9 -9
View File
@@ -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 stdout
if 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),