дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 03:05:40 +02:00
- The IDE is a GUI-subsystem binary, so Windows allocated a fresh console
window for every console-subsystem child it started: one black window per
language server, per settings-driven restart, per debug adapter and per
toolchain probe, titled with the child's own path. Closing it killed the
child, which is how editing the language-server settings broke highlighting.
- Peer::spawn, the spawn point for every language server, wired stdio but never
passed CREATE_NO_WINDOW. The rustup-proxy probe, the DAP adapter, debugpy
probe, runInTerminal and cargo spawns, the SDK probes, the run-configuration
probes, the coverage exporter and tool diagnostics/downloads (curl, tar) had
the same gap, while git, cargo builds, gh, docker and run configurations
passed the flag inline — five copies of the magic constant, six subsystems
without it.
- Add ide_core::process::{CREATE_NO_WINDOW, hide_console_window} as the single
definition, route every spawn through it (tokio commands via as_std_mut()) and
fold the inline copies into it.
- Verified locally on Windows with a console-detached harness: a plain spawn
reports a visible console window (GetConsoleWindow + IsWindowVisible), the
patched Peer::spawn reports a console without a window. cargo check, cargo
clippy --all-targets and the affected test suites (249 tests) are green.
Co-authored-by: l0ng-ai <[email protected]>
21 рядки
764 B
Rust
21 рядки
764 B
Rust
//! Child-process helpers shared by every crate that spawns tools.
|
|
|
|
use std::process::Command;
|
|
|
|
/// Windows `CREATE_NO_WINDOW` creation flag, for call sites that combine it
|
|
/// with other flags. Prefer [`no_window`] otherwise.
|
|
pub const CREATE_NO_WINDOW: u32 = 0x0800_0000;
|
|
|
|
/// Keeps a console child (java, node, curl, a language server, ...) from
|
|
/// opening its own console window on Windows. Release builds use the GUI
|
|
/// subsystem, so without this every spawn flashes a `cmd` window. A no-op
|
|
/// elsewhere. For a `tokio::process::Command`, pass `cmd.as_std_mut()`.
|
|
pub fn no_window(cmd: &mut Command) -> &mut Command {
|
|
#[cfg(windows)]
|
|
{
|
|
use std::os::windows::process::CommandExt;
|
|
cmd.creation_flags(CREATE_NO_WINDOW);
|
|
}
|
|
cmd
|
|
}
|