(defvar epg-debug-buffer nil)
(defvar epg-agent-file nil)
(defvar epg-agent-mtime nil)
-(defvar epg-error-output nil)
;; from gnupg/include/cipher.h
(defconst epg-cipher-algorithm-alist
result
operation
pinentry-mode
- (error-output ""))
+ (error-output "")
+ error-buffer)
;; This is not an alias, just so we can mark it as autoloaded.
;;;###autoload
(symbol-name (epg-context-pinentry-mode
context))))
args))
- (coding-system-for-write 'binary)
- (coding-system-for-read 'binary)
- process-connection-type
(process-environment process-environment)
(buffer (generate-new-buffer " *epg*"))
+ error-process
process
terminal-name
agent-file
(make-local-variable 'epg-agent-file)
(setq epg-agent-file agent-file)
(make-local-variable 'epg-agent-mtime)
- (setq epg-agent-mtime agent-mtime)
- (make-local-variable 'epg-error-output)
- (setq epg-error-output nil))
+ (setq epg-agent-mtime agent-mtime))
+ (setq error-process
+ (make-pipe-process :name "epg-error"
+ :buffer (generate-new-buffer " *epg-error*")
+ ;; Suppress "XXX finished" line.
+ :sentinel #'ignore
+ :noquery t))
+ (setf (epg-context-error-buffer context) (process-buffer error-process))
(with-file-modes 448
- (setq process (apply #'start-process "epg" buffer
- (epg-context-program context) args)))
- (set-process-filter process #'epg--process-filter)
+ (setq process (make-process :name "epg"
+ :buffer buffer
+ :command (cons (epg-context-program context)
+ args)
+ :connection-type 'pipe
+ :coding '(binary . binary)
+ :filter #'epg--process-filter
+ :stderr error-process
+ :noquery t)))
(setf (epg-context-process context) process)))
(defun epg--process-filter (process input)
(if (and symbol
(fboundp symbol))
(funcall symbol epg-context string)))
- (setq epg-last-status (cons status string)))
- ;; Record other lines sent to stderr. This assumes
- ;; that the process-filter receives output only from
- ;; stderr and the FD specified with --status-fd.
- (setq epg-error-output
- (cons (buffer-substring (point)
- (line-end-position))
- epg-error-output)))
+ (setq epg-last-status (cons status string))))
(forward-line)
(setq epg-read-point (point)))))))))
(epg-context-set-result-for
context 'error
(nreverse (epg-context-result-for context 'error)))
- (with-current-buffer (process-buffer (epg-context-process context))
- (setf (epg-context-error-output context)
- (mapconcat #'identity (nreverse epg-error-output) "\n"))))
+ (setf (epg-context-error-output context)
+ (with-current-buffer (epg-context-error-buffer context)
+ (buffer-string))))
(defun epg-reset (context)
"Reset the CONTEXT."
(if (and (epg-context-process context)
(buffer-live-p (process-buffer (epg-context-process context))))
(kill-buffer (process-buffer (epg-context-process context))))
+ (if (buffer-live-p (epg-context-error-buffer context))
+ (kill-buffer (epg-context-error-buffer context)))
(setf (epg-context-process context) nil)
(setf (epg-context-edit-callback context) nil))