From 82717ed0a95cf74266c4ac39bbe649029027f897 Mon Sep 17 00:00:00 2001 From: ueno Date: Tue, 25 Apr 2006 01:04:35 +0000 Subject: [PATCH] * epg.el (epg-process-sentinel): New function; set 'error if gpg process exited abnormally, but we have not received an error response from it. --- ChangeLog | 6 ++++++ epg.el | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/ChangeLog b/ChangeLog index bdccb6e..a069ad8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-04-25 Daiki Ueno + + * epg.el (epg-process-sentinel): New function; set 'error if gpg + process exited abnormally, but we have not received an error + response from it. + 2006-04-22 Daiki Ueno * epa.el (epa-key-widget-value-create): Decode DN. diff --git a/epg.el b/epg.el index dc61938..2a8c2f3 100644 --- a/epg.el +++ b/epg.el @@ -485,6 +485,7 @@ This function is for internal use only." args))) (set-default-file-modes orig-mode)) (set-process-filter process #'epg-process-filter) + (set-process-filter process #'epg-process-sentinel) (epg-context-set-process context process))) (defun epg-process-filter (process input) @@ -516,6 +517,21 @@ This function is for internal use only." (forward-line)) (setq epg-read-point (point))))) +(defun epg-process-sentinel (process status) + (if (and (buffer-live-p (process-buffer process)) + (not (equal status "finished\n"))) + (save-excursion + (set-buffer (process-buffer process)) + ;; gpg process exited abnormally, but we have not received an + ;; error response from it. + (unless (epg-context-result-for epg-context 'error) + (if (string-match "\\`exited abnormally with code \\(.*\\)\n" status) + (epg-context-result-for + epg-context 'error + (list (cons 'exit (string-to-number (match-string 1 status))))) + (epg-context-result-for epg-context 'error + (list (cons 'signal status)))))))) + (defun epg-read-output (context) (with-temp-buffer (if (fboundp 'set-buffer-multibyte) -- 1.7.10.4