Index: sysinfo/tests/process.rs
===================================================================
--- sysinfo.orig/tests/process.rs
+++ sysinfo/tests/process.rs
@@ -4,6 +4,7 @@
 
 use bstr::ByteSlice;
 use sysinfo::{Pid, ProcessRefreshKind, ProcessesToUpdate, RefreshKind, System, UpdateKind};
+use std::path::Path;
 
 macro_rules! start_proc {
     ($time:literal, $name:literal) => {
@@ -101,9 +102,11 @@ fn test_environ() {
     if !sysinfo::IS_SUPPORTED_SYSTEM || cfg!(feature = "apple-sandbox") {
         return;
     }
-    let file_name = "target/test_binary";
+    let target_dir = Path::new(option_env!("CARGO_TARGET_DIR").unwrap_or("target"));
+    let file_name = target_dir.join("test_binary");
+    let file_name = file_name.to_str().unwrap();
     build_test_binary(file_name);
-    let mut p = std::process::Command::new(format!("./{file_name}"))
+    let mut p = std::process::Command::new(file_name)
         .env("FOO", "BAR")
         .env("OTHER", "VALUE")
         .spawn()
@@ -138,7 +141,7 @@ fn test_environ() {
     for _ in 0..SIZE {
         big_env.push('a');
     }
-    let mut p = std::process::Command::new("./target/test_binary")
+    let mut p = std::process::Command::new(file_name)
         .env("FOO", &big_env)
         .spawn()
         .unwrap();
@@ -916,9 +919,11 @@ fn test_parent_change() {
         return;
     }
 
-    let file_name = "target/test_binary2";
+    let target_dir = Path::new(option_env!("CARGO_TARGET_DIR").unwrap_or("target"));
+    let file_name = target_dir.join("test_binary2");
+    let file_name = file_name.to_str().unwrap();
     build_test_binary(file_name);
-    let mut p = std::process::Command::new(format!("./{file_name}"))
+    let mut p = std::process::Command::new(file_name)
         .arg("1")
         .spawn()
         .unwrap();
@@ -965,13 +970,15 @@ fn test_multiple_single_process_refresh(
         return;
     }
 
-    let file_name = "target/test_binary3";
+    let target_dir = Path::new(option_env!("CARGO_TARGET_DIR").unwrap_or("target"));
+    let file_name = target_dir.join("test_binary3");
+    let file_name = file_name.to_str().unwrap();
     build_test_binary(file_name);
-    let mut p_a = std::process::Command::new(format!("./{file_name}"))
+    let mut p_a = std::process::Command::new(file_name)
         .arg("1")
         .spawn()
         .unwrap();
-    let mut p_b = std::process::Command::new(format!("./{file_name}"))
+    let mut p_b = std::process::Command::new(file_name)
         .arg("1")
         .spawn()
         .unwrap();
@@ -1068,9 +1075,11 @@ fn test_exists() {
         return;
     }
 
-    let file_name = "target/test_binary4";
+    let target_dir = Path::new(option_env!("CARGO_TARGET_DIR").unwrap_or("target"));
+    let file_name = target_dir.join("test_binary4");
+    let file_name = file_name.to_str().unwrap();
     build_test_binary(file_name);
-    let mut p = std::process::Command::new(format!("./{file_name}"))
+    let mut p = std::process::Command::new(file_name)
         .arg("1")
         .spawn()
         .unwrap();
