Index: sysinfo/tests/process.rs
===================================================================
--- sysinfo.orig/tests/process.rs
+++ sysinfo/tests/process.rs
@@ -1,6 +1,7 @@
 // Take a look at the license at the top of the repository in the LICENSE file.
 
 use sysinfo::{Pid, ProcessRefreshKind, System, UpdateKind};
+use std::path::Path;
 
 #[test]
 fn test_cwd() {
@@ -97,9 +98,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()
@@ -130,7 +133,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();
@@ -808,9 +811,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();
