1 Commits
Author SHA256 Message Date
kira b90544bac5 Trying using absolute paths now for binaries executions. 2026-07-15 16:15:09 +02:00
3 changed files with 14 additions and 9 deletions
Generated
+1 -1
View File
@@ -287,7 +287,7 @@ checksum = "6aa2c4e539b869820a2b82e1aef6ff40aa85e65decdd5185e83fb4b1249cd00f"
[[package]]
name = "nyanit"
version = "0.1.3"
version = "0.1.4"
dependencies = [
"ratatui",
"ratatui-textarea",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "nyanit"
version = "0.1.3"
version = "0.1.4"
edition = "2024"
[dependencies]
+12 -7
View File
@@ -101,7 +101,9 @@ impl std::error::Error for ExecCommandError {}
/// exec given command with arguments, capturing stderr in case or failure
pub fn exec_command(cmd: &str, args: &Vec<&str>) -> Result<(), ExecCommandError> {
let out = Command::new(cmd).args(args).output()?;
// For testing shake lets assume all binaries is in /usr/bin
let ex_cmd = format!("/usr/bin/{}", cmd);
let out = Command::new(ex_cmd).args(args).output()?;
if out.status.success() {
Ok(())
} else {
@@ -236,13 +238,16 @@ pub fn set_env_vars_unsafe() -> () {
let custom_lib = "/usr/lib";
// 2. Retrieve existing paths to append/prepend (optional but recommended)
let existing_path = env::var("PATH").unwrap_or_else(|_| String::new());
let existing_ld_path = env::var("LD_LIBRARY_PATH").unwrap_or_else(|_| String::new());
// 3. Construct new path strings
// Prepend custom paths so they take precedence
let new_path = format!("{}:{}", custom_bin, existing_path);
let new_ld_path = format!("{}:{}", custom_lib, existing_ld_path);
let new_path = match env::var("PATH") {
Err(_) => custom_bin.to_string(),
Ok(v) => format!("{}:{}", v, custom_bin)
};
let new_ld_path = match env::var("LD_LIBRARY_PATH") {
Err(_) => custom_lib.to_string(),
Ok(v) => format!("{}:{}", v, custom_lib)
};
// 4. Set environment variables (UNSAFE in Rust 2024+)
// MUST be done before spawning any threads or async runtimes