Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid crash for XDG_CONFIG_HOME=/dev/null #4200

Merged
merged 1 commit into from
Jun 10, 2024
Merged

Avoid crash for XDG_CONFIG_HOME=/dev/null #4200

merged 1 commit into from
Jun 10, 2024

Conversation

charliermarsh
Copy link
Member

Summary

Closes #4199.

Test Plan

XDG_CONFIG_HOME=/dev/null cargo run venv

@charliermarsh charliermarsh added the bug Something isn't working label Jun 10, 2024
@@ -26,7 +26,17 @@ impl Workspace {
debug!("Loading user configuration from: `{}`", file.display());
match read_file(&file) {
Ok(options) => Ok(Some(Self { options, root })),
Err(WorkspaceError::Io(err)) if err.kind() == std::io::ErrorKind::NotFound => Ok(None),
Err(WorkspaceError::Io(err)) if matches!(err.kind(), std::io::ErrorKind::NotFound) => {
Copy link
Member

Choose a reason for hiding this comment

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

Why this change? Just curious.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops, mistake. I started by changing it to match against NotADirectory.

Err(_) if !dir.is_dir() => {
// Ex) `XDG_CONFIG_HOME=/dev/null`
debug!(
"User configuration directory `{}` does not exist",
Copy link
Member

Choose a reason for hiding this comment

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

I might say, "... does not exist or is not a directory"

@charliermarsh charliermarsh enabled auto-merge (squash) June 10, 2024 17:28
@charliermarsh charliermarsh merged commit 652c112 into main Jun 10, 2024
47 checks passed
@charliermarsh charliermarsh deleted the charlie/toml branch June 10, 2024 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

failed to open file /dev/null/uv/uv.toml
3 participants