Do not emit newline when output port is not a terminal - pee - Pee a password manager;Pee - because you have to...
(HTM) git clone git://vernunftzentrum.de/pee.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 1972068875ef76ee24e82be3b4c1b4d6cb34cd79
(DIR) parent a4546464f3861d6009be2feb43ab4101164134a9
(HTM) Author: Christian Kellermann <ckeen@pestilenz.org>
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(-)
---
(DIR) 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))))