;; details.
(catch 'done
(dotimes (_ (if (process-tty-name target 'stdin) 3 1))
- (unless (eq (process-status target) 'run)
+ (unless (process-live-p target)
(throw 'done nil))
(process-send-eof target))))
;; If `process-send-string' raises an error and the process has
;; finished, treat it as a broken pipe. Otherwise, just
;; re-throw the signal.
- (if (memq (process-status target)
- '(run stop open closed))
+ (if (process-live-p target)
(signal (car err) (cdr err))
(signal 'eshell-pipe-broken (list target)))))
object)
(eshell-reset)))
(defun eshell-wait-for-process (&rest procs)
- "Wait until PROC has successfully completed."
- (while procs
- (let ((proc (car procs)))
- (when (eshell-processp proc)
- ;; NYI: If the process gets stopped here, that's bad.
- (while (assq proc eshell-process-list)
- (if (input-pending-p)
- (discard-input))
- (sit-for eshell-process-wait-seconds
- eshell-process-wait-milliseconds))))
- (setq procs (cdr procs))))
+ "Wait until PROCS have successfully completed."
+ (dolist (proc procs)
+ (when (eshell-processp proc)
+ (while (process-live-p proc)
+ (when (input-pending-p)
+ (discard-input))
+ (sit-for eshell-process-wait-seconds
+ eshell-process-wait-milliseconds)))))
(defalias 'eshell/wait #'eshell-wait-for-process)
If QUERY is non-nil, query the user with QUERY before calling FUNC."
(let (defunct result)
(dolist (entry eshell-process-list)
- (if (and (memq (process-status (car entry))
- '(run stop open closed))
+ (if (and (process-live-p (car entry))
(or all
(not (cdr entry)))
(or (not query)
(y-or-n-p (format-message query
(process-name (car entry))))))
(setq result (funcall func (car entry))))
- (unless (memq (process-status (car entry))
- '(run stop open closed))
+ (unless (process-live-p (car entry))
(setq defunct (cons entry defunct))))
;; clean up the process list; this can get dirty if an error
;; occurred that brought the user into the debugger, and then they