Juan Lanus wrote:
> On 6/16/06, Bram Moolenaar <[EMAIL PROTECTED]> wrote:
> >
> > Mathias Michaelis wrote:
> >
> > > >> If I do :!dir a console opens and says:
> > > >> C:\WINNT\system32\CMD.EXE /c dir
> > > >> shell returned -1
> > > >>
> > > >
> > > > 2) If 1) doesn't help, you may want to produce the phenomena outside
> > > > of vim. Open a cmd-window and type something like
> > > >
> > > > "path\to\vim\vimrun.exe" %windir%\system32\cmd.exe /c dir
> > > >
> > > Juan told me he could reproduce the error outside of vim like that.
> > > I then consulted
> > >
> > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_system.2c_._wsystem.asp
> > >
> > > and saw that vimrun.exe doesn't issue the full information of the
> > > error if the system() function call returns -1. This is why I
> > > suggest the following patch:
> >
> > I'm not sure perror() can be used in general after system(). Otherwise
> > it makes sense.
>
> Besides capturing the error, I suggest that vimrun.exe do a safer
> parsing of its input.
> Vimrun assumes that a space in the command line is a space in the
> command path, and this issue demonstrates that it's not always true.
Can you give me an example where vimrun fails? I'm quite sure the
current mechanism should not be changed. Note that vimrun is only meant
to be invoked from Vim, not by anything else.
> Windows might pass a COMSPEC string with slash arguments (slash in
> Windows is like hyphen in UNIX).
Does system() work at all then?
> Also, vim (not vimrun but the vim.exe) doesn't seem to have honored
> the :set shell= stuff. It used the COMSPEC string despite the shell
> specified.
>
> For to trigger this issue set COMSPEC=...\cmd.exe /e:2048 and try to
> do !!dir
Appears to work fine for me. Keep in mind that when you change 'shell'
you also need to change other options, such as 'shellredir'. But I
assume 'shell' didn't change here, only $COMSPEC.
Vim essentially uses system() to execute 'shell'. This is tricky, but
the only what that works reliably.
--
Bravely bold Sir Robin, rode forth from Camelot,
He was not afraid to die, Oh Brave Sir Robin,
He was not at all afraid to be killed in nasty ways
Brave, brave, brave, brave Sir Robin.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///