emacs-devel
[Top][All Lists]
Advanced

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

Re: Race condition in eshell-gather-process-output


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

On Sat, Jan 19, 2013 at 1:16 PM, Andreas Schwab <address@hidden> wrote:
> Jürgen Hötzel <address@hidden> writes:
>
>>             (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!
>
> It isn't.  Process output isn't read until accept-process-output is
> called.

I did this test in Eshell:

~ $ bash -c "echo test1 && sleep 1 && echo test2"
test1
test2
~ $

Than inserting a delay in obove code:


....
              (apply 'start-file-process
                     (file-name-nondirectory command) nil
                     ;; `start-process' can't deal with relative filenames.
                     (append (list (expand-file-name command)) args))))
      (sleep-for 1)
      (eshell-record-process-object proc)
....

results in:

~ $ bash -c "echo test1 && sleep 1 && echo test2"
test2
~ $

missing the first line of output

Regards,

Jürgen



reply via email to

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