summaryrefslogtreecommitdiffhomepage
path: root/test/test-runner
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2024-10-07 10:40:02 +0200
committerDavid Lönnhager <david.l@mullvad.net>2024-10-18 12:04:38 +0200
commit1c209ec4d2c869c220f40f0aac04dfd363883678 (patch)
tree9de791a05172edefbac873cec6db6cf05e5262ff /test/test-runner
parent227098cec09eecd09427bca8f838fa828b6cabf2 (diff)
downloadmullvadvpn-1c209ec4d2c869c220f40f0aac04dfd363883678.tar.xz
mullvadvpn-1c209ec4d2c869c220f40f0aac04dfd363883678.zip
Set HOME env var in test runner
Diffstat (limited to 'test/test-runner')
-rw-r--r--test/test-runner/Cargo.toml1
-rw-r--r--test/test-runner/src/main.rs18
2 files changed, 16 insertions, 3 deletions
diff --git a/test/test-runner/Cargo.toml b/test/test-runner/Cargo.toml
index 7206cb394a..8df61e7164 100644
--- a/test/test-runner/Cargo.toml
+++ b/test/test-runner/Cargo.toml
@@ -11,6 +11,7 @@ rust-version.workspace = true
workspace = true
[dependencies]
+dirs = "5.0.1"
futures = { workspace = true }
tarpc = { workspace = true }
tokio = { workspace = true }
diff --git a/test/test-runner/src/main.rs b/test/test-runner/src/main.rs
index 79bc17b4ef..735e61360e 100644
--- a/test/test-runner/src/main.rs
+++ b/test/test-runner/src/main.rs
@@ -92,12 +92,24 @@ impl Service for TestServer {
log::debug!("Exec {} (args: {args:?})", path);
let mut cmd = Command::new(&path);
+ cmd.stdout(Stdio::piped());
+ cmd.stderr(Stdio::piped());
+ cmd.stdin(Stdio::piped());
cmd.args(args);
- // Make sure that PATH is updated
- // TODO: We currently do not need this on non-Windows
#[cfg(target_os = "windows")]
- cmd.env("PATH", sys::get_system_path_var()?);
+ {
+ // Make sure that PATH is updated
+ cmd.env("PATH", sys::get_system_path_var()?);
+ if let Some(home_dir) = dirs::home_dir() {
+ cmd.env("USERPROFILE", home_dir);
+ }
+ }
+
+ #[cfg(unix)]
+ if let Some(home_dir) = dirs::home_dir() {
+ cmd.env("HOME", home_dir);
+ }
cmd.envs(env);