|
From: | Paul Eggert |
Subject: | Re: some accept-process-output races fixed; Tramp FIXMEs |
Date: | Wed, 16 Jan 2019 16:15:09 -0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 |
On 1/16/19 11:07 AM, Stefan Monnier wrote:
I think we should make sure that (if (not (process-live-p p)) (progn (accept-process-output p) ;; Here we should be sure that we processed all the output whereas IIUC currently we need (if (not (process-live-p p)) (progn (while (accept-process-output p)) ;; Here we are presumably sure that we processed all the output
Both those approaches should work now. In my earlier email I was worried about the slightly-different case where P exits just before (accept-process-output P DELAY) is called. In this case accept-process-output might not slurp all the data from P even if P has already exited. However, in the above scenarios, where Emacs "knows" that P has exited before (accept-process-output P) is called with no DELAY, no data should go missing on any sane POSIX platform (though admittedly I can't cite chapter and verse on this and I suspect POSIX does not strictly require it).
However, I'm still puzzled by Tramp's use of (while (or (accept-process-output p 0.1) (process-live-p p))) to get all P's output. Why not use (while (accept-process-output p)) instead, which is simpler and avoids the race condition I mentioned? Maybe something to do with timers? I'm at a loss there.
[Prev in Thread] | Current Thread | [Next in Thread] |