Skip to content

Commit

Permalink
Merge pull request #1031 from christiangnrd/warn-invalid-link
Browse files Browse the repository at this point in the history
Notify user when trying to launch nonexistent linked channel
  • Loading branch information
davidanthoff authored Oct 6, 2024
2 parents d0aac1a + e9fe7e3 commit 9cd8fb8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/bin/julialauncher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,12 +396,15 @@ fn run_app() -> Result<i32> {
}

// replace the current process
std::process::Command::new(julia_path)
std::process::Command::new(&julia_path)
.args(&new_args)
.exec();

// this is never reached
Ok(0)
// this is only ever reached if launching Julia fails
panic!(
"Could not launch Julia. Verify that there is a valid Julia binary at \"{}\".",
julia_path.to_string_lossy()
)
}
Ok(ForkResult::Child) => {
// double-fork to prevent zombies
Expand Down
5 changes: 5 additions & 0 deletions src/command_link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::config_file::{load_mut_config_db, save_config_db};
use crate::global_paths::GlobalPaths;
#[cfg(not(windows))]
use crate::operations::create_symlink;
use crate::utils::is_valid_julia_path;
use crate::versions_file::load_versions_db;
use anyhow::{bail, Context, Result};
use path_absolutize::Absolutize;
Expand Down Expand Up @@ -32,6 +33,10 @@ pub fn run_command_link(
.absolutize()
.with_context(|| format!("Failed to convert path `{}` to absolute path.", file))?;

if !is_valid_julia_path(&absolute_file_path.to_path_buf()) {
eprintln!("WARNING: There is no julia binary at {}. If this was a mistake, run `juliaup remove {}` and try again.", absolute_file_path.to_string_lossy(), channel);
}

config_file.data.installed_channels.insert(
channel.to_string(),
JuliaupConfigChannel::LinkedChannel {
Expand Down

0 comments on commit 9cd8fb8

Please sign in to comment.