aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ange-ftp.el18
1 files changed, 17 insertions, 1 deletions
diff --git a/lisp/ange-ftp.el b/lisp/ange-ftp.el
index 7230044e499..bd190091ec3 100644
--- a/lisp/ange-ftp.el
+++ b/lisp/ange-ftp.el
@@ -1974,7 +1974,23 @@ on the gateway machine to do the ftp instead."
1974 (process-kill-without-query proc) 1974 (process-kill-without-query proc)
1975 (set-process-sentinel proc (function ange-ftp-process-sentinel)) 1975 (set-process-sentinel proc (function ange-ftp-process-sentinel))
1976 (set-process-filter proc (function ange-ftp-process-filter)) 1976 (set-process-filter proc (function ange-ftp-process-filter))
1977 (accept-process-output proc) ;wait for ftp startup message 1977 ;; wait for ftp startup message
1978 (if (not (eq system-type 'windows-nt))
1979 (accept-process-output proc)
1980 ;; On Windows, the standard ftp client behaves a little oddly,
1981 ;; initially buffering its output (because stdin/out are pipe
1982 ;; handles). As a result, the startup message doesn't appear
1983 ;; until enough output is generated to flush stdout, so a plain
1984 ;; accept-process-output call at this point would hang
1985 ;; indefinitely. So if nothing appears within 2 seconds, we try
1986 ;; sending an innocuous command ("help foo") that forces some
1987 ;; output. Curiously, once we start sending normal commands, the
1988 ;; output no longer appears to be buffered, and everything works
1989 ;; correctly (or at least appears to!).
1990 (if (accept-process-output proc 2)
1991 nil
1992 (process-send-string proc "help foo\n")
1993 (accept-process-output proc)))
1978 proc)) 1994 proc))
1979 1995
1980(put 'internal-ange-ftp-mode 'mode-class 'special) 1996(put 'internal-ange-ftp-mode 'mode-class 'special)