SHA256
Compare commits
| Author | SHA256 | Date | |
|---|---|---|---|
|
|
b90544bac5 |
Generated
+1
-1
@@ -287,7 +287,7 @@ checksum = "6aa2c4e539b869820a2b82e1aef6ff40aa85e65decdd5185e83fb4b1249cd00f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nyanit"
|
name = "nyanit"
|
||||||
version = "0.1.3"
|
version = "0.1.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ratatui",
|
"ratatui",
|
||||||
"ratatui-textarea",
|
"ratatui-textarea",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nyanit"
|
name = "nyanit"
|
||||||
version = "0.1.3"
|
version = "0.1.4"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
+12
-7
@@ -101,7 +101,9 @@ impl std::error::Error for ExecCommandError {}
|
|||||||
|
|
||||||
/// exec given command with arguments, capturing stderr in case or failure
|
/// exec given command with arguments, capturing stderr in case or failure
|
||||||
pub fn exec_command(cmd: &str, args: &Vec<&str>) -> Result<(), ExecCommandError> {
|
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() {
|
if out.status.success() {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
@@ -236,13 +238,16 @@ pub fn set_env_vars_unsafe() -> () {
|
|||||||
let custom_lib = "/usr/lib";
|
let custom_lib = "/usr/lib";
|
||||||
|
|
||||||
// 2. Retrieve existing paths to append/prepend (optional but recommended)
|
// 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
|
// 3. Construct new path strings
|
||||||
// Prepend custom paths so they take precedence
|
let new_path = match env::var("PATH") {
|
||||||
let new_path = format!("{}:{}", custom_bin, existing_path);
|
Err(_) => custom_bin.to_string(),
|
||||||
let new_ld_path = format!("{}:{}", custom_lib, existing_ld_path);
|
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+)
|
// 4. Set environment variables (UNSAFE in Rust 2024+)
|
||||||
// MUST be done before spawning any threads or async runtimes
|
// MUST be done before spawning any threads or async runtimes
|
||||||
|
|||||||
Reference in New Issue
Block a user