git_clan_flake_toplevel: gracefully handle permission errors
since this code is used as a default in the cli parser, we should not crash on OSError because we wouldn't be abe to perform basic tasks such as --help.
This commit is contained in:
@@ -29,9 +29,11 @@ def get_clan_flake_toplevel_or_env() -> Path | None:
|
||||
|
||||
|
||||
def get_clan_flake_toplevel() -> Path | None:
|
||||
return find_toplevel([".clan-flake", ".git", ".hg", ".svn", "flake.nix"])
|
||||
|
||||
|
||||
try:
|
||||
return find_toplevel([".clan-flake", ".git", ".hg", ".svn", "flake.nix"])
|
||||
except OSError:
|
||||
# We might run clan from a directory that is not readable.
|
||||
return None
|
||||
|
||||
|
||||
def clan_key_safe(flake_url: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user