Commit 9deab4f3 authored by Francois-Rene Rideau's avatar Francois-Rene Rideau

launch-program: update support for SBCL on Windows

Use the :escape-arguments nil protocol committed by stassats (which will be
part of sbcl 1.3.13) rather than the direct passing of the argument as a string
that I have offered as a patch.
parent 2c940cd5
......@@ -518,20 +518,22 @@ LAUNCH-PROGRAM returns a PROCESS-INFO object."
(string
;; NB: We add cmd /c here. Behavior without going through cmd is not well specified
;; when the command contains spaces or special characters:
;; IIUC, the system will use space as a separator, but the argv-decoding libraries won't,
;; and you're supposed to use an extra argument to CreateProcess to bridge the gap,
;; but neither allegro nor clisp provide access to that argument.
;; IIUC, the system will use space as a separator,
;; but the C++ argv-decoding libraries won't, and
;; you're supposed to use an extra argument to CreateProcess to bridge the gap,
;; yet neither allegro nor clisp provide access to that argument.
#+(or allegro clisp) (strcat "cmd /c " command)
;; On ClozureCL for Windows, we assume you are using
;; r15398 or later in 1.9 or later,
;; so that bug 858 is fixed http://trac.clozure.com/ccl/ticket/858
;; On SBCL, we assume the patch from https://bugs.launchpad.net/sbcl/+bug/1503496
;; On SBCL, we assume the patch from fcae0fd (to be part of SBCL 1.3.13)
#+(or clozure sbcl) (cons "cmd" (strcat "/c " command))
;; NB: On other Windows implementations, this is utterly bogus
;; except in the most trivial cases where no quoting is needed.
;; Use at your own risk.
#-(or allegro clisp clozure sbcl)
(parameter-error "~S doesn't support string commands on Windows on this lisp: ~S" '%normalize-command command))
(parameter-error "~S doesn't support string commands on Windows on this lisp: ~S"
'launch-program command))
#+os-windows
(list
#+allegro (escape-windows-command command)
......@@ -539,6 +541,11 @@ LAUNCH-PROGRAM returns a PROCESS-INFO object."
#+(or abcl (and allegro os-unix) clozure cmucl ecl mkcl sbcl)
(let ((program (car command))
#-allegro (arguments (cdr command))))
#+(and sbcl os-windows)
(multiple-value-bind (arguments escape-arguments)
(if (listp arguments)
(values arguments t)
(values (list arguments) nil)))
#-(or allegro mkcl sbcl) (with-current-directory (directory))
(multiple-value-bind
#+(or abcl clozure cmucl sbcl scl) (process)
......@@ -557,6 +564,7 @@ LAUNCH-PROGRAM returns a PROCESS-INFO object."
#+mkcl 'mk-ext:run-program
#+sbcl 'sb-ext:run-program
#+(or abcl clozure cmucl ecl mkcl sbcl) ,@'(program arguments)
#+(and sbcl os-windows) ,@'(:escape-arguments escape-arguments)
:input input :if-input-does-not-exist :error
:output output :if-output-exists :append
,(or #+(or allegro lispworks) :error-output :error) error-output
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment