Skip to content

Commit 72beedf

Browse files
committed
devenv-run-tests: allow TZDIR through
1 parent 2502c64 commit 72beedf

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

devenv-run-tests/src/main.rs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -275,22 +275,28 @@ async fn main() -> Result<ExitCode> {
275275
// Otherwise, run the tests in a subprocess with a fresh environment.
276276
let executable_path = env::current_exe().into_diagnostic()?;
277277
let executable_dir = executable_path.parent().unwrap();
278-
let path = format!(
279-
"{}:{}",
280-
executable_dir.display(),
281-
env::var("PATH").unwrap_or_default()
282-
);
278+
let env = [
279+
("DEVENV_RUN_TESTS", "1"),
280+
("DEVENV_NIX", &env::var("DEVENV_NIX").unwrap_or_default()),
281+
(
282+
"PATH",
283+
&format!(
284+
"{}:{}",
285+
executable_dir.display(),
286+
env::var("PATH").unwrap_or_default()
287+
),
288+
),
289+
("HOME", &env::var("HOME").unwrap_or_default()),
290+
("TZDIR", &env::var("TZDIR").unwrap_or_default()),
291+
];
283292

284293
let mut cmd = Command::new(&executable_path);
285294
cmd.stdin(Stdio::inherit())
286295
.stdout(Stdio::inherit())
287296
.stderr(Stdio::inherit())
288-
.args(env::args().skip(1));
289-
cmd.env_clear()
290-
.env("DEVENV_RUN_TESTS", "1")
291-
.env("DEVENV_NIX", env::var("DEVENV_NIX").unwrap_or_default())
292-
.env("PATH", path)
293-
.env("HOME", env::var("HOME").unwrap_or_default());
297+
.args(env::args().skip(1))
298+
.env_clear()
299+
.envs(env);
294300

295301
let output = cmd.output().into_diagnostic()?;
296302
if output.status.success() {

0 commit comments

Comments
 (0)