emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using `call-process-shell-command' in `process-lines'


From: Eli Zaretskii
Subject: Re: Using `call-process-shell-command' in `process-lines'
Date: Mon, 26 Nov 2007 22:38:10 +0200

> Date: Mon, 26 Nov 2007 18:28:12 +0100
> From: "Lennart Borgman (gmail)" <address@hidden>
> Cc: Stefan Monnier <address@hidden>,
>       Emacs Devel <address@hidden>
> 
> In a cmd.exe shell I can execute
> 
>     find -name "*.el"
> 
> with desired result (using gnuwin32 find.exe), but
> 
>     find -name *.el
> 
> fails with
> 
>     find: paths must precede expression
>     Usage: find [path...] [expression]
> 
> Doesn't it look like arg passing in find.exe is a bit strange?

No, it's not a problem with find.exe, it's a problem with the function
spawnve (called by call-process) in the Windows runtime library.

Unlike on Posix platforms, where the sibling function execve passes
the separate command-line arguments directly to the child process (in
this case, find), the Windows implementation first constructs a single
command-line string from all the separate arguments, and then passes
the result to the Windows API CreateProcess.  The concatenation of the
arguments is mandatory, since CreateProcess requires a single string
command, but the misfeature of spawnve is that it does not quote the
separate arguments as appropriate while concatenating them, and thus
the semantics of some of the arguments changes.

We could fix that by wrapping spawnve with code that quotes arguments
which need quoting.  I have working code somewhere that I can dust off
(bumped into this problem while porting RCS to Windows).  Then the
application Lisp code could be left intact.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]