Thursday, January 30, 2014

Re: Escaping for system()

On Thursday, January 30, 2014 9:22:15 AM UTC-6, Andrew Stewart wrote:
> Hello!
>
> I have a plugin which uses `system(command, input)` to run some external commands. There seem to be a few escaping problems (mostly on Windows).
>
> So I did some research and wrote it all up here: https://github.com/airblade/vim-system-escape
>
> In a nutshell I'd like to write a VimL `shellescape(str)` function which gets the escaping right for all Vim versions greater than, say, 7.0. I.e. implement the current built-in escaping logic in VimL.
>
> And maybe have a similar function which escapes the whole command passed to `system(command)`...though I'm not sure yet whether that's necessary.
>
> Anyway, I'd be most grateful for suggestions and/or feedback on my notes at the link above.
>
> Thanks in advance,
>
> Andy Stewart

A novel approach I've seen in a plugin (I don't remember which one), is to write all the desired shell commands to a temporary file, write it as a .bat file, and then execute THAT file in the shell instead of the original commands. Then very little escaping is needed.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: