Skip to content
Snippets Groups Projects
Commit c82dbc6b authored by nimrod's avatar nimrod
Browse files

download-password-db: Close open passhole databases.

parent 961b25e0
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,18 @@ DEST = os.path.expanduser(f"~/{ os.path.dirname(DB_PATH) }")
SOURCE = f"nextcloud:{DB_PATH}"
def close_passhole():
"""Try to close passhole. Ignore all failures including no open database
and failed import (to avoid dependency on passhole)."""
try:
# pylint: disable=import-outside-toplevel
from pykeepass_cache.pykeepass_cache import close
close()
except (ImportError, OSError):
pass
if __name__ == "__main__":
username = input(f"Enter username (defaults to {getpass.getuser()}): ")
if not username:
......@@ -31,6 +43,7 @@ if __name__ == "__main__":
check=True,
text=True,
).stdout.strip()
close_passhole()
os.execvp( # nosec
"rclone",
[
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment