Skip to content

Commit

Permalink
refactor: Rewrite logic to get first element of mount dirs
Browse files Browse the repository at this point in the history
Using `next(iter(...))` is equally elegant as `.pop`. However, it will
work with mappings and sets, proactively fixing a bug that would
otherwise come up when updating storge-device-manager.
  • Loading branch information
MaxG87 committed Nov 27, 2024
1 parent 0f723a3 commit 916472d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/butter_backup/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def close(config: Path = CONFIG_OPTION, verbose: int = VERBOSITY_OPTION) -> None
raise ValueError(
"Got several possible mount points. Expected exactly 1!"
)
mount_dir = mount_dirs.pop()
mount_dir = next(iter(mount_dirs))
sdm.unmount_device(mount_dir)
sdm.close_decrypted_device(Path(mapped_device))
mount_dir.rmdir()
Expand Down

0 comments on commit 916472d

Please sign in to comment.