fix(run): keep classpath and target probes from opening console windows on Windows (#4562)

On Windows the GUI-subsystem app gave console children their own window unless they were spawned with CREATE_NO_WINDOW. Three probes used a bare std Command: the Maven classpath probe behind delegated Run/Debug, the .NET target-path probe and go list for file-scoped Go tests. The first two now go through ide_core::process::prepare; the Go probe, whose environment is already built, gets the flag. The other backend spawn sites already prepare.
This commit is contained in:
l0ng-ai
2026-11-20 00:42:56 +08:00
committed by GitHub
parent efce16d45d
commit dd14e8b040
3 changed files with 9 additions and 5 deletions
+3 -4
View File
@@ -236,10 +236,9 @@ fn classpath(
}
args.extend(["dependency:build-classpath", output_arg.as_str(), scope_arg.as_str(), "-q"]);
let top_dir = subdir(root, &target.top.dir);
let status = ProcCommand::new(&target.top.command)
.args(&args)
.envs(&target.top.env)
.current_dir(&top_dir)
let mut command = ProcCommand::new(&target.top.command);
command.args(&args).envs(&target.top.env).current_dir(&top_dir);
let status = ide_core::process::prepare(&mut command)
.output()
.map_err(|e| IdeError::internal(format!("cannot resolve the compile classpath: {e}")))?;
if !status.status.success() {
+1 -1
View File
@@ -230,7 +230,7 @@ pub async fn target_path(root: &Path, config: &RunConfig) -> IdeResult<String> {
}
let mut command = std::process::Command::new(&config.command);
command.args(args).current_dir(root);
ide_core::process::host_env(&mut command);
ide_core::process::prepare(&mut command);
if !config.extras.include_system_env {
command.env_clear();
} else {
+5
View File
@@ -124,6 +124,11 @@ fn package_info(mut command: Command, dir: &Path, flags: &[String]) -> IdeResult
}
}
command.arg(".").current_dir(dir).stdin(Stdio::null()).stdout(Stdio::piped()).stderr(Stdio::piped());
#[cfg(windows)]
{
use std::os::windows::process::CommandExt;
command.creation_flags(ide_core::process::CREATE_NO_WINDOW);
}
let mut child = command.spawn()?;
let stdout = child.stdout.take();
let stderr = child.stderr.take();