[Openmcl-devel] Run-program on windows with path names containing spaces

Ron Garret ron at flownet.com
Sun Feb 16 01:34:54 UTC 2014


This seems to work better than what is currently there:

(let ((*WARN-IF-REDEFINE-KERNEL* nil))
  (defun ccl::make-windows-command-line (strings)
    (setf strings (mapcar 'prin1-to-string strings))
    (reduce (lambda (s1 s2) (concatenate 'string s1 " " s2))
            (cdr strings) :initial-value (car strings))))

rg

On Feb 14, 2014, at 7:35 AM, Loïc Maury <lmaury at gmail.com> wrote:

> To follow the problem, can you launch on Window, for-example notepad.exe ?
> 
> I try but that doesn't work,
> 
> (run-program "notepad" '() :input t :output :stream)
> 
> and seem to be blocked for ever ?
> 
> if I pass an argument (the name of file), in command line for example
> 
> (run-program "notepad" '("foo") :input t :output :stream)
> 
> it ask me if I want to create it and stay blocked too.
> 
> However command from cygwin (touch, cat) work well.
> 
> On linux everything work fine.
> 
> Thank you
> 
> Loic
> 
> 
> On Fri, Feb 14, 2014 at 12:10 AM, Anton Vodonosov <avodonosov at yandex.ru> wrote:
> I investigated this, it's definitely a bug in CCL 1.9
> 
> On CCL 1.9 on Windows, when you call ccl:run-program, it's parameter PROGRAM is preppended
> to the ARGS parameter to form a single list of strings, then this list is passed
> to ccl::make-windows-command-line to form a single command line string, and then
> that string is passed to CreateProcess WinAPI function as the second parameter
> lpCommandLine (http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx)
> 
> See linux-files.lisp in CCL sources.
> 
> Suppose I want to start a program C:\Program Files (x86)\acl90express\alisp.exe
> without arguments.
> 
> In Lisp it must be called like this:
> 
>   (ccl:run-program "C:\\Program Files (x86)\\acl90express\\alisp.exe" '())
> 
> WinAPI CreateProcess function should receive the following lpCommandLine
> 
>   "\"C:\\Program Files (x86)\\acl90express\\alisp.exe\""
> 
> i.e. all the executable path must be surrounded by double quotes to prevent
> spaces in the path to be interpreted as separators.
> 
> But CCL computes different thing:
> 
>   (format t "~A~%" (ccl::make-windows-command-line '("C:\\Program Files (x86)\\acl90express\\alisp.exe")))
>   => C:\Program" "Files" "(x86)\acl90express\alisp.exe
> 
> i.e. CCL surrounds every space by double quotes, instead of surrounding
> whole executable path.
> 
> Probably we need to reopen #858 or submit a new ticket.
> 
> Best regards,
> - Anton
> 
> 
> 
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.clozure.com/pipermail/openmcl-devel/attachments/20140215/cc1d0510/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.clozure.com/pipermail/openmcl-devel/attachments/20140215/cc1d0510/attachment.pgp>


More information about the Openmcl-devel mailing list