James Vega wrote:
>On Fri, Nov 16, 2007 at 10:01:03AM -0500, Charles E Campbell Jr wrote:
>
>
>>gour wrote:
>>
>>
>>>I hit the problem in vim yesterday when I wanted to run fish shell
>>>(http://fishshell.org) within vim and soon got informed that the
>>>problem is
>>>
>>>
>>Exactly what is the problem? Are you trying to use system(), or filters
>>(:!), or what?
>>
>>
>
>It's easily observable using system() but anything else that tries to
>invoke commands in a subshell and capture the output will run into the
>same problem. Vim is running this command
>
> /usr/bin/fish -c "(ls /tmp) >/tmp/v244859/1"
>
>fish doesn't allow you to use a subshell command as the actual command
>being run. That is, the above command-line errors out (in an
>interactive shell) with "Illegal command name (ls /tmp)". Vim should
>simply be running it as
>
> /usr/bin/fish -c "ls /tmp >/tmp/v244859/1"
>
>From what I've seen in Vim's shell-related options, there isn't anything
>to affect this.
>
>
I wrote a small C program:
/* myecho.c: this program simply echos its arguments to <myecho.out>
* Author: Charles E. Campbell, Jr.
* Date: Nov 16, 2007
*/
#include <stdio.h>
#include <string.h>
/* --------------------------------------------------------------------- */
/* main: {{{2 */
int main(
int argc,
char **argv)
{
char buf[256];
char *b;
int i;
FILE *fp;
for(i= 0, b= buf; i < argc; ++i) {
sprintf(b,"%s%s",
argv[i],
(i == argc-1)? "" : " ");
b+= strlen(b);
}
fp= fopen("myecho.out","w");
fprintf(fp,"%s\n",buf);
fclose(fp);
return 0;
}
compiled it (to myecho), brought up Vim, then :set
shell=/home/cec/myecho . I then tried
:!ls
and myecho.out was:
/home/cec/myecho -c ls /tmp
No subshells there! I then tried
:call system("ls /tmp")
and got: (an error message about not being able to open E484: Can't
open file /tmp/v238233/2, because myecho doesn't do such things)
/home/cec/myecho -c (ls /tmp) >/tmp/v238167/2
Finally I tried filtering (one line, ls /tmp, used V!ls). Got the now
expected E484, and myecho.out shows:
/home/cec/myecho -c (ls) < /tmp/v238333/2 >/tmp/v238333/3
So: two out of three methods of using the shell do seem to use subshells.
Regards,
Chip Campbell
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---