| 84 | | (let ((coding-system-for-write 'binary) |
|---|
| 85 | | (input (buffer-substring-no-properties start end)) |
|---|
| 86 | | (default-enable-multibyte-characters nil)) |
|---|
| 87 | | (with-temp-buffer |
|---|
| 88 | | (when passphrase |
|---|
| 89 | | (insert passphrase "\n")) |
|---|
| 90 | | (insert input) |
|---|
| 91 | | (setq exit-status |
|---|
| 92 | | (apply #'call-process-region (point-min) (point-max) program |
|---|
| 93 | | nil errors-buffer nil args)))) |
|---|
| | 87 | (let ((coding-system-for-write 'binary)) |
|---|
| | 88 | (setq process |
|---|
| | 89 | (apply #'start-process "*GnuPG*" errors-buffer |
|---|
| | 90 | program args))) |
|---|
| | 91 | (set-process-sentinel process #'ignore) |
|---|
| | 92 | (when passphrase |
|---|
| | 93 | (setq passphrase-with-newline (concat passphrase "\n")) |
|---|
| | 94 | (if pgg-passphrase-coding-system |
|---|
| | 95 | (progn |
|---|
| | 96 | (setq encoded-passphrase-with-new-line |
|---|
| | 97 | (encode-coding-string passphrase-with-newline |
|---|
| | 98 | pgg-passphrase-coding-system)) |
|---|
| | 99 | (pgg-clear-string passphrase-with-newline)) |
|---|
| | 100 | (setq encoded-passphrase-with-new-line passphrase-with-newline |
|---|
| | 101 | passphrase-with-newline nil)) |
|---|
| | 102 | (process-send-string process encoded-passphrase-with-new-line)) |
|---|
| | 103 | (process-send-region process start end) |
|---|
| | 104 | (process-send-eof process) |
|---|
| | 105 | (while (eq 'run (process-status process)) |
|---|
| | 106 | (accept-process-output process 5)) |
|---|
| | 107 | (setq status (process-status process) |
|---|
| | 108 | exit-status (process-exit-status process)) |
|---|
| | 109 | (delete-process process) |
|---|
| 103 | | (if (not (equal exit-status 0)) |
|---|
| 104 | | (insert (format "\n%s exited abnormally: '%s'\n" |
|---|
| 105 | | program exit-status))))) |
|---|
| | 119 | (if (memq status '(stop signal)) |
|---|
| | 120 | (error "%s exited abnormally: '%s'" program exit-status)) |
|---|
| | 121 | (if (= 127 exit-status) |
|---|
| | 122 | (error "%s could not be found" program)))) |
|---|
| | 123 | (if passphrase-with-newline |
|---|
| | 124 | (pgg-clear-string passphrase-with-newline)) |
|---|
| | 125 | (if encoded-passphrase-with-new-line |
|---|
| | 126 | (pgg-clear-string encoded-passphrase-with-new-line)) |
|---|
| | 127 | (if (and process (eq 'run (process-status process))) |
|---|
| | 128 | (interrupt-process process)) |
|---|