emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Race condition in eshell-gather-process-output


From: Jürgen Hötzel
Subject: Race condition in eshell-gather-process-output
Date: Sat, 19 Jan 2013 12:28:19 +0100

Hi,

I stumbled across this while debugging eshell/tramp external commands:

In eshell-gather-process-output the external process is started using
start-file-process:

      (setq proc
            (let ((process-connection-type
                   (unless (eshell-needs-pipe-p command)
                     process-connection-type))
                  (command (or (file-remote-p command 'localname) command)))
              (apply 'start-file-process
                     (file-name-nondirectory command) nil
                     ;; `start-process' can't deal with relative filenames.
                     (append (list (expand-file-name command)) args))))
----------------------------------------------------------------------------------------
something can happen meanwhile: The process may have written
output (nil output buffer)
----------------------------------------------------------------------------------------

      (eshell-record-process-object proc)
      (set-process-buffer proc (current-buffer))

^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Maybe too late to set output buffer!

Why is the output buffer not set directly:

(apply 'start-file-process
                     (file-name-nondirectory command) (current-buffer)
                     ...)

Regards,

Jürgen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]