From d4eb9f85d07351e184ba16ff91c327425653d3e9 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 13 Oct 2023 15:59:44 +0200 Subject: 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 Signed-off-by: Lukas Fleischer --- contrib/caldav/calcurse-caldav.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'contrib/caldav') diff --git a/contrib/caldav/calcurse-caldav.py b/contrib/caldav/calcurse-caldav.py index f9488e6..8cccdf7 100755 --- a/contrib/caldav/calcurse-caldav.py +++ b/contrib/caldav/calcurse-caldav.py @@ -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 -- cgit v1.2.3-54-g00ecf