Skip to content

Commit

Permalink
Avoid crash for XDG_CONFIG_HOME=/dev/null
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jun 10, 2024
1 parent 14d535f commit 7aba04a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/uv-workspace/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ impl Workspace {
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(_) if !dir.is_dir() => {
// Ex) `XDG_CONFIG_HOME=/dev/null`
debug!(
"User configuration directory `{}` does not exist or is not a directory",
dir.display()
);
Ok(None)
}
Err(err) => Err(err),
}
}
Expand Down

0 comments on commit 7aba04a

Please sign in to comment.