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

Re: wait asynchronous process



>> On Tue, 11 Nov 2003 15:57:38 +0900
>> "kose" == kose@wizard.tamra.co.jp (小関 吉則 (KOSEKI Yoshinori)) said as follows:

kose> 改行コードが CRLF のファイルでは Fail します。(Solarisでも)

確かに.

kose> (buffer-size) が LF に変換後の size になりませんか?

それならば,以下のような検証例ではどうでしょう?

(let ((file "/etc/wgetrc")
      (times 20)
      (count 0)
      (success 0)
      (process-connection-type t)
      (coding-system-for-read 'binary)
      (default-process-coding-system (cons 'binary 'binary)))
  (while (<= (setq count (1+ count)) times)
    (with-temp-buffer
      (set-buffer-multibyte nil)
      (let ((proc (start-process "cat" (current-buffer) "cat" file)))
        (set-process-sentinel proc 'ignore)
        (while (or (accept-process-output proc 0 0)
                   (memq (process-status proc) '(run stop))))
        (sit-for 0 5 t)
        (if (= (buffer-size) (nth 7 (file-attributes file)))
            (setq success (1+ success))))))
  (if (= success times)
      (message "Success")
    (message "Fail (%d/%d)" success times)))

-- 
土屋 雅稔 ( TSUCHIYA Masatoshi )