diff --git a/src/bin/julialauncher.rs b/src/bin/julialauncher.rs index a057ec53..d5400bc3 100644 --- a/src/bin/julialauncher.rs +++ b/src/bin/julialauncher.rs @@ -4,7 +4,7 @@ use itertools::Itertools; use juliaup::config_file::{load_config_db, JuliaupConfig, JuliaupConfigChannel}; use juliaup::global_paths::get_paths; use juliaup::jsonstructs_versionsdb::JuliaupVersionDB; -use juliaup::operations::is_valid_channel; +use juliaup::operations::{is_pr_channel, is_valid_channel}; use juliaup::versions_file::load_versions_db; #[cfg(not(windows))] use nix::{ @@ -175,6 +175,8 @@ fn get_julia_path_from_channel( JuliaupChannelSource::CmdLine => { if channel_valid { UserError { msg: format!("`{}` is not installed. Please run `juliaup add {}` to install channel or version.", channel, channel) } + } else if is_pr_channel(&channel.to_string()) { + UserError { msg: format!("`{}` is not installed. Please run `juliaup add {}` to install pull request channel if available.", channel, channel) } } else { UserError { msg: format!("ERROR: Invalid Juliaup channel `{}`. Please run `juliaup list` to get a list of valid channels and versions.", channel) } } @@ -182,6 +184,8 @@ fn get_julia_path_from_channel( JuliaupChannelSource::EnvVar=> { if channel_valid { UserError { msg: format!("`{}` from environment variable JULIAUP_CHANNEL is not installed. Please run `juliaup add {}` to install channel or version.", channel, channel) } + } else if is_pr_channel(&channel.to_string()) { + UserError { msg: format!("`{}` from environment variable JULIAUP_CHANNEL is not installed. Please run `juliaup add {}` to install pull request channel if available.", channel, channel) } } else { UserError { msg: format!("ERROR: Invalid Juliaup channel `{}` from environment variable JULIAUP_CHANNEL. Please run `juliaup list` to get a list of valid channels and versions.", channel) } } @@ -189,6 +193,8 @@ fn get_julia_path_from_channel( JuliaupChannelSource::Override=> { if channel_valid { UserError { msg: format!("`{}` from directory override is not installed. Please run `juliaup add {}` to install channel or version.", channel, channel) } + } else if is_pr_channel(&channel.to_string()){ + UserError { msg: format!("`{}` from directory override is not installed. Please run `juliaup add {}` to install pull request channel if available.", channel, channel) } } else { UserError { msg: format!("ERROR: Invalid Juliaup channel `{}` from directory override. Please run `juliaup list` to get a list of valid channels and versions.", channel) } } diff --git a/tests/channel_selection.rs b/tests/channel_selection.rs index 3ea5bac3..02909a58 100644 --- a/tests/channel_selection.rs +++ b/tests/channel_selection.rs @@ -151,4 +151,17 @@ fn channel_selection() { .assert() .failure() .stderr("`nightly` is not installed. Please run `juliaup add nightly` to install channel or version.\n"); + + // https://github.com/JuliaLang/juliaup/issues/995 + Command::cargo_bin("julia") + .unwrap() + .arg("+pr1") + .arg("-e") + .arg("print(VERSION)") + .env("JULIA_DEPOT_PATH", depot_dir.path()) + .env("JULIAUP_DEPOT_PATH", depot_dir.path()) + .env("JULIAUP_CHANNEL", "1.7.4") + .assert() + .failure() + .stderr("`pr1` is not installed. Please run `juliaup add pr1` to install pull request channel if available.\n"); }