m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/contrib/emacs
diff options
context:
space:
mode:
authorSvend Sorensen <svend@ciffer.net>2015-03-16 10:50:28 -0700
committerSvend Sorensen <svend@ciffer.net>2015-03-16 11:00:58 -0700
commit4d1bf39fbd6e08f3df2735b584c9ab5daffece8f (patch)
treeed3cfa40d32a8ec740c58afa679238d8a48e5773 /contrib/emacs
parent1ba31d7ed03f0cab4f7b9104041eeb15dd1bf013 (diff)
emacs: Separate stdout and stderr
This fixes a problem where gnupg-agent messages would get mixed with the password content.
Diffstat (limited to 'contrib/emacs')
-rw-r--r--contrib/emacs/password-store.el15
1 files changed, 10 insertions, 5 deletions
diff --git a/contrib/emacs/password-store.el b/contrib/emacs/password-store.el
index 746f133..e9acaad 100644
--- a/contrib/emacs/password-store.el
+++ b/contrib/emacs/password-store.el
@@ -54,11 +54,16 @@
Nil arguments are ignored. Returns the output on success, or
outputs error message on failure."
(with-temp-buffer
- (let ((exit-code
- (apply 'call-process
- (append
- (list password-store-executable nil (current-buffer) nil)
- (-reject 'null args)))))
+ (let* ((tempfile (make-temp-file ""))
+ (exit-code
+ (apply 'call-process
+ (append
+ (list password-store-executable nil (list t tempfile) nil)
+ (-reject 'null args)))))
+ (unless (zerop exit-code)
+ (erase-buffer)
+ (insert-file-contents tempfile))
+ (delete-file tempfile)
(if (zerop exit-code)
(s-chomp (buffer-string))
(error (s-chomp (buffer-string)))))))