Closed hrehfeld closed 1 year ago
When the async-start-process callback function accidentally kills the processes buffer itself, this kills one other (previous) buffer:
async-start-process
(defun async-when-done (proc &optional _change) "Process sentinel used to retrieve the value from the child process." (when (eq 'exit (process-status proc)) (with-current-buffer (process-buffer proc) (let ((async-current-process proc)) (if (= 0 (process-exit-status proc)) (if async-callback-for-process (if async-callback (prog1 (funcall async-callback proc) (unless async-debug (kill-buffer (current-buffer)))) ;; FIXME: this may erroneously kill the wrong buffer (set (make-local-variable 'async-callback-value) proc) (set (make-local-variable 'async-callback-value-set) t)) (goto-char (point-max)) (backward-sexp) (async-handle-result async-callback (read (current-buffer)) (current-buffer))) (set (make-local-variable 'async-callback-value) (list 'error (format "Async process '%s' failed with exit code %d" (process-name proc) (process-exit-status proc)))) (set (make-local-variable 'async-callback-value-set) t))))))
I believe the fix is to kill (process-buffer proc) instead. You probably should also check if it is still existing. :boom:
(process-buffer proc)
Please also add to the documentation of async-start-process that user callbacks don't need to kill the process's buffer.
Thanks!
When the
async-start-process
callback function accidentally kills the processes buffer itself, this kills one other (previous) buffer:I believe the fix is to kill
(process-buffer proc)
instead. You probably should also check if it is still existing. :boom:Please also add to the documentation of
async-start-process
that user callbacks don't need to kill the process's buffer.