Remove new line character from result of password command

For example, using `pass caldav` as `PasswordCommand` returns the
password for the account including a newline character at the end
because the whole output is captured. This fix removes the new line
character at the end of the line while keeping other whitespace
character should the password contain any at the end.

Signed-off-by: Max <max@mxzero.net>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Max authored and Lukas Fleischer committed 2023-11-06 15:42:59 -05:00
1 parent 535088c809
commit d4eb9f85d0
1 file changed
+2 -1
+2 -1
View File
@@ -680,7 +680,8 @@ elif config.get('Auth', 'Password'):
password = config.get('Auth', 'Password')
elif config.get('Auth', 'PasswordCommand'):
tokenized_cmd = shlex.split(config.get('Auth', 'PasswordCommand'))
password = subprocess.run(tokenized_cmd, capture_output=True).stdout.decode('UTF-8')
password = subprocess.run(
tokenized_cmd, capture_output=True).stdout.decode('UTF-8').rstrip('\n')
else:
password = None