A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.
Rust agentagent-orchestrationaiai-agentsclaude-codecodexcoding-agentlinuxmacosmultiplayermultiplexerrustterminalterminal-emulatorterminal-multiplexertmuxtuiweztermwindows
feat(update): wait for the Windows installer and restart into the update
RoversXb8a22a2addc9
diff --git a/thinkterm-i18n/i18n/de-DE.ftl b/thinkterm-i18n/i18n/de-DE.ftlindex f78cfc69..3c85023a 100644--- a/thinkterm-i18n/i18n/de-DE.ftl+++ b/thinkterm-i18n/i18n/de-DE.ftl@@ -198,7 +198,6 @@ settings-update-download-source-direct = GitHub (direkt)settings-update-download-source-auto = Automatischsettings-local-sessions-via-mux = Lokale Terminals in einem Hintergrund-Sitzungsserver haltensettings-local-sessions-via-mux-description = Lokale Terminals laufen in einem Mux-Server auf diesem Rechner und überstehen das Beenden, Abstürzen oder Aktualisieren von ThinkTerm. Wird beim nächsten Start von ThinkTerm wirksam.-settings-local-sessions-via-mux-description-windows = Lokale Terminals laufen in einem Mux-Server auf diesem Rechner und überstehen das Beenden oder Abstürzen von ThinkTerm. Eine Aktualisierung von ThinkTerm beendet den Server. Wird beim nächsten Start von ThinkTerm wirksam.settings-terminal-heading = Terminal-Konfigurationsettings-terminal-font-heading = Schriftsettings-terminal-display-heading = Anzeige@@ -1019,8 +1018,6 @@ settings-update-minutes-left = noch etwa { $count } minsettings-update-installing-title = ThinkTerm { $version } wird installiert…settings-update-installed = ThinkTerm { $version } ist installiert.settings-update-installed-detail = Starten Sie ThinkTerm neu, um die neue Version zu verwenden.-settings-update-installer-started = Das Installationsprogramm läuft.-settings-update-installer-started-detail = Es beendet ThinkTerm, installiert { $version } und öffnet es wieder.settings-update-install-failed-title = Das Update konnte nicht installiert werden.settings-update-failed-detail = Was schiefging, steht unten.settings-update-install-note = „Update installieren“ ersetzt die Dateien an Ort und Stelle; ThinkTerm läuft mit der aktuellen Version weiter, bis es neu gestartet wird.diff --git a/thinkterm-i18n/i18n/en-US.ftl b/thinkterm-i18n/i18n/en-US.ftlindex 7891d5fd..b1f50723 100644--- a/thinkterm-i18n/i18n/en-US.ftl+++ b/thinkterm-i18n/i18n/en-US.ftl@@ -198,7 +198,6 @@ settings-update-download-source-direct = GitHub (direct)settings-update-download-source-auto = Automaticsettings-local-sessions-via-mux = Keep local terminals in a background session serversettings-local-sessions-via-mux-description = Local terminals run in a mux server on this machine and survive quitting, crashing or updating ThinkTerm. Takes effect the next time ThinkTerm starts.-settings-local-sessions-via-mux-description-windows = Local terminals run in a mux server on this machine and survive quitting or crashing ThinkTerm. Updating ThinkTerm stops the server. Takes effect the next time ThinkTerm starts.settings-terminal-heading = Terminal configurationsettings-terminal-font-heading = Fontsettings-terminal-display-heading = Display@@ -1019,8 +1018,6 @@ settings-update-minutes-left = about { $count } min leftsettings-update-installing-title = Installing ThinkTerm { $version }…settings-update-installed = ThinkTerm { $version } is installed.settings-update-installed-detail = Restart ThinkTerm to start using it.-settings-update-installer-started = The installer is running.-settings-update-installer-started-detail = It closes ThinkTerm, installs { $version } and opens it again.settings-update-install-failed-title = The update could not be installed.settings-update-failed-detail = What went wrong is shown below.settings-update-install-note = Install Update replaces the files in place; ThinkTerm keeps running the current version until it restarts.diff --git a/thinkterm-i18n/i18n/fr-FR.ftl b/thinkterm-i18n/i18n/fr-FR.ftlindex 97b12db1..0331a1a4 100644--- a/thinkterm-i18n/i18n/fr-FR.ftl+++ b/thinkterm-i18n/i18n/fr-FR.ftl@@ -198,7 +198,6 @@ settings-update-download-source-direct = GitHub (direct)settings-update-download-source-auto = Automatiquesettings-local-sessions-via-mux = Garder les terminaux locaux dans un serveur de sessions en arrière-plansettings-local-sessions-via-mux-description = Les terminaux locaux tournent dans un serveur mux sur cette machine et survivent à la fermeture, au plantage ou à la mise à jour de ThinkTerm. Prend effet au prochain lancement.-settings-local-sessions-via-mux-description-windows = Les terminaux locaux tournent dans un serveur mux sur cette machine et survivent à la fermeture ou au plantage de ThinkTerm. Mettre à jour ThinkTerm arrête le serveur. Prend effet au prochain lancement.settings-terminal-heading = Configuration du terminalsettings-terminal-font-heading = Policesettings-terminal-display-heading = Affichage@@ -1013,8 +1012,6 @@ settings-update-minutes-left = environ { $count } min restantessettings-update-installing-title = Installation de ThinkTerm { $version }…settings-update-installed = ThinkTerm { $version } est installé.settings-update-installed-detail = Redémarrez ThinkTerm pour utiliser la nouvelle version.-settings-update-installer-started = Le programme d'installation est en cours.-settings-update-installer-started-detail = Il ferme ThinkTerm, installe { $version } puis le rouvre.settings-update-install-failed-title = La mise à jour n'a pas pu être installée.settings-update-failed-detail = Le détail de l'erreur figure ci-dessous.settings-update-install-note = Installer la mise à jour remplace les fichiers sur place ; ThinkTerm continue d'exécuter la version actuelle jusqu'à son redémarrage.diff --git a/thinkterm-i18n/i18n/ja-JP.ftl b/thinkterm-i18n/i18n/ja-JP.ftlindex ddfcff83..25f8fcff 100644--- a/thinkterm-i18n/i18n/ja-JP.ftl+++ b/thinkterm-i18n/i18n/ja-JP.ftl@@ -195,7 +195,6 @@ settings-update-download-source-direct = GitHub(直接)settings-update-download-source-auto = 自動settings-local-sessions-via-mux = ローカル端末をバックグラウンドのセッションサーバーに置くsettings-local-sessions-via-mux-description = ローカル端末はこのマシンの mux サーバーで動作し、ThinkTerm の終了・クラッシュ・更新後も残ります。次回起動時に有効になります。-settings-local-sessions-via-mux-description-windows = ローカル端末はこのマシンの mux サーバーで動作し、ThinkTerm の終了・クラッシュ後も残ります。ThinkTerm を更新するとサーバーは停止します。次回起動時に有効になります。settings-terminal-heading = ターミナル設定settings-terminal-font-heading = フォントsettings-terminal-display-heading = 表示@@ -989,8 +988,6 @@ settings-update-minutes-left = 残り約 { $count } 分settings-update-installing-title = ThinkTerm { $version } をインストール中…settings-update-installed = ThinkTerm { $version } をインストールしました。settings-update-installed-detail = ThinkTerm を再起動すると新しいバージョンを使えます。-settings-update-installer-started = インストーラーを実行中です。-settings-update-installer-started-detail = ThinkTerm を終了し、{ $version } をインストールしてから再び開きます。settings-update-install-failed-title = アップデートをインストールできませんでした。settings-update-failed-detail = 詳細は下に表示されています。settings-update-install-note = 「アップデートをインストール」はファイルをその場で置き換えます。再起動するまで ThinkTerm は現在のバージョンのまま動作します。diff --git a/thinkterm-i18n/i18n/zh-CN.ftl b/thinkterm-i18n/i18n/zh-CN.ftlindex 6a543e0c..e8953ba3 100644--- a/thinkterm-i18n/i18n/zh-CN.ftl+++ b/thinkterm-i18n/i18n/zh-CN.ftl@@ -195,7 +195,6 @@ settings-update-download-source-direct = 直连 GitHubsettings-update-download-source-auto = 自动settings-local-sessions-via-mux = 本地终端放在后台会话 server 里settings-local-sessions-via-mux-description = 本地终端跑在本机的 mux server 中,ThinkTerm 退出、崩溃或更新后会话仍在。下次启动 ThinkTerm 时生效。-settings-local-sessions-via-mux-description-windows = 本地终端跑在本机的 mux server 中,ThinkTerm 退出或崩溃后会话仍在;更新 ThinkTerm 会停止该 server。下次启动 ThinkTerm 时生效。settings-terminal-heading = 终端配置settings-terminal-font-heading = 字体settings-terminal-display-heading = 显示@@ -989,8 +988,6 @@ settings-update-minutes-left = 约 { $count } 分钟settings-update-installing-title = 正在安装 ThinkTerm { $version }…settings-update-installed = ThinkTerm { $version } 已安装。settings-update-installed-detail = 重启后开始使用新版本。-settings-update-installer-started = 安装程序正在运行。-settings-update-installer-started-detail = 它会关闭 ThinkTerm,安装 { $version } 后再重新打开。settings-update-install-failed-title = 更新安装失败。settings-update-failed-detail = 原因见下方。settings-update-install-note = "安装更新"会原地替换文件;在重启之前,ThinkTerm 仍运行当前版本。diff --git a/thinkterm-update/src/lib.rs b/thinkterm-update/src/lib.rsindex ddf91b44..12d6f1f1 100644--- a/thinkterm-update/src/lib.rs+++ b/thinkterm-update/src/lib.rs@@ -501,14 +501,17 @@ fn windows_installer_name(arch: &str, version: &str) -> String {}}-/// Windows: fetch the release's installer and hand over to it. Inno Setup-/// closes the running ThinkTerm, replaces the files and restarts it, so-/// this process must not wait for it -- it is one of the files.+/// Windows: fetch the release's installer and run it to the end. It moves+/// the files of a running ThinkTerm aside rather than close it (see+/// ci/windows-installer.iss), so this process -- one of those files --+/// keeps running the old build until it is restarted, as on the other+/// platforms, and can wait for the outcome.////// `/SILENT` keeps the progress window and drops every question; `/SP-`-/// skips the "this will install" prompt; the two APPLICATIONS switches let-/// the installer stop and restart a running ThinkTerm rather than fail on a-/// locked file. Elevation is the installer's own UAC prompt.+/// skips the "this will install" prompt; `/NOCLOSEAPPLICATIONS` keeps the+/// installer from ever closing a running ThinkTerm -- a file it cannot move+/// aside fails the install instead; `/LOG` keeps its log beside the+/// download. Elevation is the installer's own UAC prompt.pub fn run_windows_installer(release: &Release,progress: &mut dyn FnMut(InstallProgress),@@ -532,12 +535,32 @@ pub fn run_windows_installer(}progress(InstallProgress::Installing);- println!("starting the installer: {}", path.display());- std::process::Command::new(&path)- .args(["/SILENT", "/SP-", "/CLOSEAPPLICATIONS", "/RESTARTAPPLICATIONS", "/NORESTART"])- .spawn()+ let log = dir.join(format!("{}.log", asset.name));+ println!("running the installer: {}", path.display());+ let status = std::process::Command::new(&path)+ .args(["/SILENT", "/SP-", "/NOCLOSEAPPLICATIONS", "/NORESTART"])+ .arg(format!("/LOG={}", log.display()))+ .status().with_context(|| format!("starting {}", path.display()))?;- Ok(())+ installer_outcome(status.code(), &log)+}++/// What the installer's exit code says about the install.+fn installer_outcome(code: Option<i32>, log: &std::path::Path) -> anyhow::Result<()> {+ match code {+ Some(0) => Ok(()),+ // Before the install began (a declined UAC prompt among them), or+ // during it.+ Some(2) | Some(5) => Err(anyhow!("the installer was cancelled")),+ Some(code) => Err(anyhow!(+ "the installer failed (exit code {code}); its log is {}",+ log.display()+ )),+ None => Err(anyhow!(+ "the installer ended without an exit code; its log is {}",+ log.display()+ )),+ }}fn get_github_release_info(uri: &str) -> anyhow::Result<Release> {@@ -1722,6 +1745,20 @@ mod tests {assert_eq!(windows_installer_name("aarch64", "1.2.3"), "ThinkTerm-1.2.3-arm64-setup.exe");}+ #[test]+ fn only_a_clean_installer_exit_is_an_install() {+ let log = std::path::Path::new("setup.log");+ assert!(installer_outcome(Some(0), log).is_ok());+ for cancelled in [2, 5] {+ let err = installer_outcome(Some(cancelled), log).unwrap_err().to_string();+ assert!(err.contains("cancelled"), "{cancelled}: {err}");+ }+ // Preparing failed: a file in use that could not be moved aside.+ let err = installer_outcome(Some(7), log).unwrap_err().to_string();+ assert!(err.contains("exit code 7") && err.contains("setup.log"), "{err}");+ assert!(installer_outcome(None, log).is_err());+ }+#[test]fn glibc_versions_parse_from_getconf_output() {assert_eq!(parse_glibc_version("glibc 2.31\n"), Some((2, 31)));diff --git a/wezterm-gui/src/local_sessions.rs b/wezterm-gui/src/local_sessions.rsindex 8f5c71cf..13b35f0c 100644--- a/wezterm-gui/src/local_sessions.rs+++ b/wezterm-gui/src/local_sessions.rs@@ -28,10 +28,8 @@ static HOST: OnceLock<Option<String>> = OnceLock::new();static FELL_BACK: Mutex<bool> = Mutex::new(false);/// Whether this build and platform can run local sessions in a server.-/// Unix and Windows both can; what Windows lacks is the handoff that keeps-/// sessions across an update (it passes descriptors), so there the server-/// simply keeps serving and a newly launched GUI reconnects to it, and an-/// update stops it.+/// Unix and Windows both can, and both keep the sessions across an update:+/// the new build's server takes them over from the running one.pub(crate) fn supported() -> bool {cfg!(any(unix, windows))}diff --git a/wezterm-gui/src/settings_window.rs b/wezterm-gui/src/settings_window.rsindex b59969ee..894396cd 100644--- a/wezterm-gui/src/settings_window.rs+++ b/wezterm-gui/src/settings_window.rs@@ -636,7 +636,7 @@ pub(crate) fn update_capsule_status() -> Option<UpdateCapsuleStatus> {},},Some(UpdateInstall::Installed { .. }) => UpdateCapsuleStatus::Installed {- restart: !cfg!(windows) && !restart_ends_terminals_lately(),+ restart: !restart_ends_terminals_lately(),},Some(UpdateInstall::Failed { .. }) => UpdateCapsuleStatus::Failed,None => UpdateCapsuleStatus::Available {@@ -668,7 +668,6 @@ fn restart_ends_terminals_lately() -> bool {/// terminals after all.pub(crate) fn restart_into_update() -> bool {if !matches!(update_install(), Some(UpdateInstall::Installed { .. }))- || cfg!(windows)|| restart_ends_terminals(){return false;@@ -8493,14 +8492,7 @@ impl SettingsWindow {tw,band,&crate::i18n::tr("settings-local-sessions-via-mux"),- // Windows has no in-place handoff: sessions survive- // quitting and crashing there, not updating, and the- // text says so.- if cfg!(windows) {- "settings-local-sessions-via-mux-description-windows"- } else {- "settings-local-sessions-via-mux-description"- },+ "settings-local-sessions-via-mux-description",this.native_settings.workspaces.local_sessions_via_mux,SettingsAction::ToggleLocalSessionsViaMux,)?;@@ -16141,7 +16133,7 @@ impl SettingsWindow {// this copy is ours to replace, with a check under it, as a newer// release may have come out since; restart once it has been// replaced; check otherwise. While an install runs there is nothing- // to click, and the Windows installer restarts ThinkTerm itself.+ // to click.let self_updatable = self.ui.update_method@@ -16152,10 +16144,8 @@ impl SettingsWindow {(_, Some(UpdateInstall::Running { .. })) => vec![],// Restart only where it ends no terminal: shells this process// runs itself would go with it, so there the person quits and- // reopens when ready. The Windows installer restarts by itself.- (_, Some(UpdateInstall::Installed { .. }))- if !cfg!(windows) && !restart_ends_terminals() =>- {+ // reopens when ready.+ (_, Some(UpdateInstall::Installed { .. })) if !restart_ends_terminals() => {vec![(crate::i18n::tr("settings-restart"),SettingsAction::RestartApplication,@@ -16231,14 +16221,6 @@ impl SettingsWindow {crate::i18n::tr("settings-update-installing"),None,),- (Some(UpdateInstall::Installed { version }), _) if cfg!(windows) => (- crate::i18n::tr("settings-update-installer-started"),- settings_tr(- "settings-update-installer-started-detail",- &[("version", version.clone())],- ),- None,- ),(Some(UpdateInstall::Installed { version }), _) => (settings_tr("settings-update-installed", &[("version", version.clone())]),crate::i18n::tr("settings-update-installed-detail"),diff --git a/wezterm/src/main.rs b/wezterm/src/main.rsindex a5c02a66..9b3b7aa1 100644--- a/wezterm/src/main.rs+++ b/wezterm/src/main.rs@@ -862,7 +862,10 @@ impl UpdateCommand {if matches!(method, InstallMethod::WindowsInstaller) || (cfg!(windows) && matches!(method, InstallMethod::Unknown)) {if !self.yes {- print!("Download the {target_version} installer and run it? It will close ThinkTerm and reopen it. [y/N] ");+ print!(+ "Download the {target_version} installer and run it? ThinkTerm keeps running \+ and moves to {target_version} when it restarts. [y/N] "+ );std::io::stdout().flush()?;let mut answer = String::new();std::io::stdin().read_line(&mut answer)?;@@ -875,7 +878,10 @@ impl UpdateCommand {let mut progress = CliInstallProgress::new();thinkterm_update::run_windows_installer(&target, &mut |p| progress.report(p))?;}- println!("The installer is running; it finishes on its own.");+ println!(+ "Installed {target_version}. A running thinkterm-mux-server or GUI keeps the old \+ build until it is restarted."+ );return Ok(());}