Skip to content

Commit 7e131b3

Browse files
authored
Merge pull request #2008 from cachix/fix-clickhouse-tz
examples: fix tzdir issues with clickhouse
2 parents d26f9cf + fcba79b commit 7e131b3

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

devenv-run-tests/src/main.rs

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -275,22 +275,32 @@ 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+
279+
let mut env = vec![
280+
("DEVENV_RUN_TESTS", "1".to_string()),
281+
("DEVENV_NIX", env::var("DEVENV_NIX").unwrap_or_default()),
282+
(
283+
"PATH",
284+
format!(
285+
"{}:{}",
286+
executable_dir.display(),
287+
env::var("PATH").unwrap_or_default()
288+
),
289+
),
290+
("HOME", env::var("HOME").unwrap_or_default()),
291+
];
292+
293+
if let Ok(tzdir) = env::var("TZDIR") {
294+
env.push(("TZDIR", tzdir));
295+
}
283296

284297
let mut cmd = Command::new(&executable_path);
285298
cmd.stdin(Stdio::inherit())
286299
.stdout(Stdio::inherit())
287300
.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());
301+
.args(env::args().skip(1))
302+
.env_clear()
303+
.envs(env);
294304

295305
let output = cmd.output().into_diagnostic()?;
296306
if output.status.success() {

0 commit comments

Comments
 (0)