diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-07 21:53:59 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-07 21:54:29 +0300 |
| commit | 6f459691056b68c2c99d8341b5f8dd4b811a53c1 (patch) | |
| tree | 24c780f3813945feef4c0b48be1645ac22067691 /src/cli.rs | |
| parent | 0a635a3fc1e971030079945a447c73e2b24489f8 (diff) | |
fix(update): keep windows installs on preview
Diffstat (limited to 'src/cli.rs')
| -rw-r--r-- | src/cli.rs | 46 |
1 files changed, 37 insertions, 9 deletions
@@ -79,7 +79,7 @@ fn channel_set(args: &[String]) -> std::io::Result<i32> { return Ok(2); }; - if let Some(reason) = channel_set_preview_rejection( + if let Some(reason) = channel_set_rejection( channel, crate::update::preview_channel_rejection_for_current_install(), ) { @@ -151,13 +151,21 @@ fn parse_channel_set_arg(args: &[String]) -> Option<&str> { } } -fn channel_set_preview_rejection( +fn channel_set_rejection( channel: &str, install_rejection: Option<&'static str>, ) -> Option<&'static str> { - (channel == "preview") - .then_some(install_rejection) - .flatten() + if cfg!(windows) && channel == "stable" { + return Some( + "stable channel is not available on Windows yet; Windows builds are preview-only", + ); + } + + if channel == "preview" { + return install_rejection; + } + + None } #[derive(Debug, Clone, Copy, PartialEq, Eq)] @@ -898,14 +906,34 @@ mod tests { #[test] fn channel_set_rejects_package_managed_preview_before_config_write() { assert_eq!( - super::channel_set_preview_rejection("preview", Some("no preview")), + super::channel_set_rejection("preview", Some("no preview")), Some("no preview") ); assert_eq!( - super::channel_set_preview_rejection("stable", Some("no preview")), - None + super::channel_set_rejection("stable", Some("no preview")), + if cfg!(windows) { + Some( + "stable channel is not available on Windows yet; Windows builds are preview-only", + ) + } else { + None + } + ); + assert_eq!(super::channel_set_rejection("preview", None), None); + } + + #[test] + fn channel_set_rejects_stable_only_on_windows() { + assert_eq!( + super::channel_set_rejection("stable", None), + if cfg!(windows) { + Some( + "stable channel is not available on Windows yet; Windows builds are preview-only", + ) + } else { + None + } ); - assert_eq!(super::channel_set_preview_rejection("preview", None), None); } #[test] |
