diff --git a/lisp/progmodes/flymake-cc.el b/lisp/progmodes/flymake-cc.el index 5733ef4d666..ecf6e648a7e 100644 --- a/lisp/progmodes/flymake-cc.el +++ b/lisp/progmodes/flymake-cc.el @@ -120,8 +120,8 @@ REPORT-FN is Flymake's callback." :noquery t :connection-type 'pipe :sentinel (lambda (p _ev) - (when (eq 'exit (process-status p)) - (unwind-protect + (unwind-protect + (when (eq 'exit (process-status p)) (when (with-current-buffer source (eq p flymake-cc--proc)) (with-current-buffer (process-buffer p) (goto-char (point-min)) @@ -135,7 +135,8 @@ REPORT-FN is Flymake's callback." :panic :explanation (buffer-substring (point-min) (progn (goto-char (point-min)) - (line-end-position)))))))) + (line-end-position))))))))) + (unless (process-live-p p) ;; (display-buffer (process-buffer p)) ; uncomment to debug (kill-buffer (process-buffer p))))))) (process-send-region flymake-cc--proc (point-min) (point-max))