diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-07-25 02:40:14 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-25 02:40:14 +0300 |
| commit | 8afd52ae57f9237f4f46138ad224dfc621d7ba59 (patch) | |
| tree | 349bbbd86c57863539ebc4c2eacf34550e076fa2 /src/update.rs | |
| parent | 5f1957c27bd23f73b339265d3acd32f4a21878a3 (diff) | |
fix: bundle modern ConPTY on Windows (#1828)
refs #1533
refs #1644
Diffstat (limited to 'src/update.rs')
| -rw-r--r-- | src/update.rs | 16 |
1 files changed, 12 insertions, 4 deletions
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<Version, String> { 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); |
