[asdf-install-devel] Re: [Sbcl-help] run-program on 1.0.13 on windows 2000

Richard M Kreuter kreuter at progn.net
Fri Jun 20 14:38:00 UTC 2008


Gary King writes:
> I've been trying to test asdf-install on VMWare Windows 2000 (hosted  
> by OS X) under SBCL 1.0.13. The SBCL version of ASDF-Install just  
> hangs an the portable version gives an unenlightening error message.  
> The problem seems to be with calls to external programs. If I start  
> sbcl and try
> 
> (with-output-to-string (out)
>   (sb-ext:run-program "path-to-handle.exe"  nil :output out :wait t))
> 
> SBCL just hangs. If I give up and type control-C, I am returned to the  
> shell.
> 
> Any thoughts on debugging this will be much appreciated,

This has been reported before.  Invoking RUN-PROGRAM so that the output
of the program goes to a Lisp stream doesn't work on Windows, and is
less a debuggable detail than a tricky-to-support interface, where the
tricks haven't been worked out yet on Windows [*].

As a workaround, if you have a POSIX shell available on your Windows
system, you might be able to get the desired result by having the shell
run the requisite commands redirecting the output to a file, and then
reading the file in, e.g.

(defun run-shell-command-for-output (command &rest args)
  (let ((output
         (pathname
          (loop thereis (open (format nil "TEMP-~D" (random 100000))
                              :direction :probe :if-exists nil
                              :if-does-not-exist :create)))))
    (run-program "sh" (list "-c" (format nil "~a ~{~a ~} > ~a"
                                         command args (namestring output)))
                 :search t :wait t)
    (prog1
        (with-open-file (stream output)
          (let ((buffer (make-array (file-length stream)
                                    :element-type 'character)))
            (subseq buffer 0 (read-sequence buffer stream))))
      (delete-file output))))

Hope that helps for now,
Richard

[*] IIRC, the specific issue is that Windows's select() only works on
sockets, not descriptors corresponding to pipes; and at the moment
SERVE-EVENT relies on a faked select() on Windows.  (There are some
other oddities in the Windows-specific code in run-program.lisp,
run-program.c, too, having to do with reads that can't possibly fail to
block, etc.)

Supporting all of RUN-PROGRAM properly on Windows probably entails a
nontrivial reworking of FD-STREAMs, SERVE-EVENT, and RUN-PROGRAM itself,
and there are some outstanding open design decisions involved, first of
which is whether to support both Win32-oid handles and POSIX-oid
descriptors in the same SBCL on Windows.  (I have a tree where
FD-STREAMs can use filehandles on Windows, and SERVE-EVENT seems to
mostly work there (thanks to Alastair Bridgewater), but couldn't manage
to get RUN-PROGRAM working with Win32 CreateProcess.  If anybody wants
to take this up, or wants me to continue working on this, please contact
me privately.)



More information about the asdf-install-devel mailing list