Do not emit newline when output port is not a terminal - pee - Pee a password m… | |
git clone git://vernunftzentrum.de/pee.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 1972068875ef76ee24e82be3b4c1b4d6cb34cd79 | |
parent a4546464f3861d6009be2feb43ab4101164134a9 | |
Author: Christian Kellermann <[email protected]> | |
Date: Mon, 22 Feb 2016 14:22:48 +0100 | |
Do not emit newline when output port is not a terminal | |
This enables piping the output into a tool like xclip. Before this | |
patch the appended newline character caused password mismatches. | |
Diffstat: | |
pee.scm | 5 ++++- | |
1 file changed, 4 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/pee.scm b/pee.scm | |
@@ -312,7 +312,10 @@ | |
(define (do-password db e) | |
(cond ((alist-ref e db equal?) => | |
- (lambda (e) (print (second e)))) | |
+ (lambda (e) | |
+ (display (second e)) | |
+ (when (terminal-port? (current-output-port)) | |
+ (newline)))) | |
(else | |
(print "Error: password for " e " not found.") | |
(exit 1)))) |