From 8afd52ae57f9237f4f46138ad224dfc621d7ba59 Mon Sep 17 00:00:00 2001 From: Can Celik Date: Sat, 25 Jul 2026 02:40:14 +0300 Subject: fix: bundle modern ConPTY on Windows (#1828) refs #1533 refs #1644 --- src/update.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/update.rs b/src/update.rs index eac917bf..3455841d 100644 --- a/src/update.rs +++ b/src/update.rs @@ -628,8 +628,12 @@ fn install_downloaded_update(mut update: DownloadedUpdate) -> Result<(), String> } #[cfg(windows)] -fn install_windows_update_with_installer(channel: UpdateChannel) -> Result<(), String> { - let status = Command::new("powershell") +fn install_windows_update_with_installer( + channel: UpdateChannel, + expected_build_id: Option<&str>, +) -> Result<(), String> { + let mut command = Command::new("powershell"); + command .args([ "-NoProfile", "-ExecutionPolicy", @@ -643,7 +647,11 @@ fn install_windows_update_with_installer(channel: UpdateChannel) -> Result<(), S // PowerShell 5.1 (this `powershell`) fails to autoload cmdlets like // Get-FileHash. Removing it lets 5.1 compute its own default path. // See PowerShell/PowerShell#8635. - .env_remove("PSModulePath") + .env_remove("PSModulePath"); + if let Some(build_id) = expected_build_id { + command.env("HERDR_EXPECTED_BUILD_ID", build_id); + } + let status = command .status() .map_err(|err| format!("failed to run Windows installer: {err}"))?; @@ -2019,7 +2027,7 @@ pub fn self_update(options: SelfUpdateOptions) -> Result { if let Some(sha256) = &release.sha256 { tracing::debug!(sha256 = %sha256, "selected Windows update asset has checksum"); } - install_windows_update_with_installer(channel)?; + install_windows_update_with_installer(channel, release.build_id.as_deref())?; let updated_exe = windows_installed_herdr_exe_path()?; eprintln!("installed {}", release.label()); print_outdated_integration_notice_with_updated_binary(&updated_exe); -- cgit v1.2.3