Skip to content

Commit

Permalink
fix: skip _.source files if not present (#3236)
Browse files Browse the repository at this point in the history
Fixes #3053
  • Loading branch information
jdx authored Nov 27, 2024
1 parent 8f31a33 commit b3cb34f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 8 additions & 0 deletions e2e/env/test_source
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

cat <<'EOF' >.mise.toml
[env]
_.file = 'not_present'
EOF

assert "mise env" # does not error
10 changes: 6 additions & 4 deletions src/config/env_directive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,12 @@ impl EnvResults {
for p in xx::file::glob(normalize_path(&config_root, s.into()))? {
r.env_files.push(p.clone());
let errfn = || eyre!("failed to parse dotenv file: {}", display_path(&p));
for item in dotenvy::from_path_iter(&p).wrap_err_with(errfn)? {
let (k, v) = item.wrap_err_with(errfn)?;
r.env_remove.remove(&k);
env.insert(k, (v, Some(p.clone())));
if let Ok(dotenv) = dotenvy::from_path_iter(&p) {
for item in dotenv {
let (k, v) = item.wrap_err_with(errfn)?;
r.env_remove.remove(&k);
env.insert(k, (v, Some(p.clone())));
}
}
}
}
Expand Down

0 comments on commit b3cb34f

Please sign in to comment.