From 4d1bf39fbd6e08f3df2735b584c9ab5daffece8f Mon Sep 17 00:00:00 2001 From: Svend Sorensen Date: Mon, 16 Mar 2015 10:50:28 -0700 Subject: emacs: Separate stdout and stderr This fixes a problem where gnupg-agent messages would get mixed with the password content. --- contrib/emacs/password-store.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'contrib/emacs/password-store.el') 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))))))) -- cgit v1.2.3-59-g8ed1b