changeset 22076:3313e702e442

(ange-ftp-start-process): Handle Windows ftp client.
author Richard M. Stallman <rms@gnu.org>
date Fri, 15 May 1998 20:35:58 +0000
parents 577e5b25f6d3
children ae5e3b23c7e2
files lisp/ange-ftp.el
diffstat 1 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ange-ftp.el	Fri May 15 05:50:20 1998 +0000
+++ b/lisp/ange-ftp.el	Fri May 15 20:35:58 1998 +0000
@@ -1974,7 +1974,23 @@
     (process-kill-without-query proc)
     (set-process-sentinel proc (function ange-ftp-process-sentinel))
     (set-process-filter proc (function ange-ftp-process-filter))
-    (accept-process-output proc)	;wait for ftp startup message
+    ;; wait for ftp startup message
+    (if (not (eq system-type 'windows-nt))
+	(accept-process-output proc)
+      ;; On Windows, the standard ftp client behaves a little oddly,
+      ;; initially buffering its output (because stdin/out are pipe
+      ;; handles).  As a result, the startup message doesn't appear
+      ;; until enough output is generated to flush stdout, so a plain
+      ;; accept-process-output call at this point would hang
+      ;; indefinitely.  So if nothing appears within 2 seconds, we try
+      ;; sending an innocuous command ("help foo") that forces some
+      ;; output.  Curiously, once we start sending normal commands, the
+      ;; output no longer appears to be buffered, and everything works
+      ;; correctly (or at least appears to!).
+      (if (accept-process-output proc 2)
+	  nil
+ 	(process-send-string proc "help foo\n")
+	(accept-process-output proc)))
     proc))
 
 (put 'internal-ange-ftp-mode 'mode-class 'special)