Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions e2e/cli/test_exec_chdir
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ mkdir direnv
assert "mise x -C $PWD/direnv -- pwd" "$(pwd)/direnv"
assert "mise x -C ./direnv -- pwd" "$(pwd)/direnv"
assert "mise x -C direnv -- pwd" "$(pwd)/direnv"

assert_fail "mise x -C non-existent -- pwd" "mise ERROR failed to set current directory to ~/workdir/non-existent"
10 changes: 8 additions & 2 deletions src/config/settings.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::cli::Cli;
use crate::config::ALL_TOML_CONFIG_FILES;
use crate::duration;
use crate::file::FindUp;
use crate::{dirs, env, file};
use crate::{duration, exit};
#[allow(unused_imports)]
use confique::env::parse::{list_by_colon, list_by_comma};
use confique::{Config, Partial};
Expand Down Expand Up @@ -100,7 +100,13 @@ pub struct SettingsFile {

impl Settings {
pub fn get() -> Arc<Self> {
Self::try_get().unwrap()
match Self::try_get() {
Ok(settings) => settings,
Err(e) => {
error!("{e}");
exit(1);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we shouldn't skip the main error handling logic. What we need to do is remove Config::get() and replace all uses with Config::try_get()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already had a feeling that this fix is not the way to go...

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to see if AI can do this

}
}
}
pub fn try_get() -> Result<Arc<Self>> {
if let Some(settings) = BASE_SETTINGS.read().unwrap().as_ref() {
Expand Down
Loading