Skip to content

Commit

Permalink
🚑 fix a bug which cause launcher will always be crashed
Browse files Browse the repository at this point in the history
  • Loading branch information
ShellWen committed Jan 2, 2025
1 parent 83bc3bc commit e3e20f3
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions crates/launcher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,23 @@ fn launch_with_env(executable: &str, args: &[&str], env: &[(&str, &str)]) {
}
}

#[allow(unreachable_code)]
pub fn launch(executable: &str, args: &[&str], lib_path: &str) {
#[cfg(target_os = "windows")]
launch_with_remote_thread_inject(executable, args, lib_path);
{
launch_with_remote_thread_inject(executable, args, lib_path);
return;
}
#[cfg(target_os = "linux")]
launch_with_env(executable, args, &[("LD_PRELOAD", lib_path)]);
{
launch_with_env(executable, args, &[("LD_PRELOAD", lib_path)]);
return;
}
#[cfg(target_os = "macos")]
launch_with_env(executable, args, &[("DYLD_INSERT_LIBRARIES", lib_path)]);
{
launch_with_env(executable, args, &[("DYLD_INSERT_LIBRARIES", lib_path)]);
return;
}

unreachable!("Unsupported platform.");
}

0 comments on commit e3e20f3

Please sign in to comment.