Skip to content

Commit b1a5032

Browse files
committed
Fix broken try / except.
1 parent 1991857 commit b1a5032

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

datashuttle/utils/rclone_encryption.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,23 +92,22 @@ def set_password_linux(cfg: Configs) -> None:
9292
"`pass` is required to set password. Install e.g. sudo apt install pass."
9393
)
9494

95-
try:
96-
output = subprocess.run(
97-
["pass", "ls"],
98-
shell=True,
99-
capture_output=True,
100-
text=True,
101-
)
102-
except subprocess.CalledProcessError as e:
103-
if "pass init" in e.stderr:
95+
output = subprocess.run(
96+
"pass ls",
97+
shell=True,
98+
capture_output=True,
99+
text=True,
100+
)
101+
if output.returncode != 0:
102+
if "pass init" in output.stderr:
104103
raise RuntimeError(
105104
"Password store is not initialized. "
106105
"Run `pass init <gpg-id>` before using `pass`."
107106
)
108107
else:
109108
raise RuntimeError(
110-
f"\n--- STDOUT ---\n{output.stdout}",
111-
f"\n--- STDERR ---\n{output.stderr}",
109+
f"\n--- STDOUT ---\n{output.stdout}"
110+
f"\n--- STDERR ---\n{output.stderr}"
112111
"Could not set up password with `pass`. See the error message above.",
113112
)
114113

0 commit comments

Comments
 (0)