From dd27c246bda6ef6251db0e4d96d574e55a67b19a Mon Sep 17 00:00:00 2001 From: Euan Kemp Date: Wed, 20 Jun 2018 17:53:21 -0700 Subject: [PATCH] pass: trim pass show output As of 8446a40, pass show will include a newline when showing a password. This causes the pass helper here to reliably fail to initialize since a password doesn't round-trip. Before making this change, the pass test would fail if the installed password-store version was v1.7.1+, and after this change it passes again. Fixes #107 Signed-off-by: Euan Kemp --- pass/pass_linux.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pass/pass_linux.go b/pass/pass_linux.go index 5cc3d33..e9ecea2 100644 --- a/pass/pass_linux.go +++ b/pass/pass_linux.go @@ -58,7 +58,8 @@ func runPass(stdin string, args ...string) (string, error) { return "", fmt.Errorf("%s: %s", err, stderr.String()) } - return stdout.String(), nil + // trim newlines; pass v1.7.1+ includes a newline at the end of `show` output + return strings.TrimRight(stdout.String(), "\n\r"), nil } // Pass handles secrets using Linux secret-service as a store.