Skip to content

Commit

Permalink
Try to fix issue #17 (async command execution on Windows without DLL)
Browse files Browse the repository at this point in the history
See issue 17 on GitHub:
  #17
  • Loading branch information
xolox committed May 21, 2015
1 parent 8076e72 commit 3e6b8fb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions autoload/xolox/misc.vim
@@ -1,7 +1,7 @@
" The version of my miscellaneous scripts.
"
" Author: Peter Odding <peter@peterodding.com>
" Last Change: April 28, 2015
" Last Change: May 21, 2015
" URL: http://peterodding.com/code/vim/misc/

let g:xolox#misc#version = '1.17.5'
let g:xolox#misc#version = '1.17.6'
17 changes: 15 additions & 2 deletions autoload/xolox/misc/os.vim
@@ -1,7 +1,7 @@
" Operating system interfaces.
"
" Author: Peter Odding <peter@peterodding.com>
" Last Change: June , 2013
" Last Change: May 21, 2015
" URL: http://peterodding.com/code/vim/misc/

function! xolox#misc#os#is_mac() " {{{1
Expand Down Expand Up @@ -158,7 +158,20 @@ function! xolox#misc#os#exec(options) " {{{1
" Enable asynchronous mode (very platform specific).
if async
if is_win
let cmd = printf('start /b %s', cmd)
" As pointed out in issue 17 [1] the use of `:!start' on Windows
" requires characters like `!', `%' and `#' to be escaped with a
" backslash [2]. Vim's shellescape() function knows how to escape
" these special characters however the use of `:!start' is an
" implementation detail of xolox#misc#os#exec() so I don't want to
" bother callers (who perform the shell escaping) with such a
" specific implementation detail. This is why I resort to manually
" escaping characters documented to have a special meaning [2].
"
" [1] https://github.com/xolox/vim-misc/issues/17
" [2] All characters interpreted specially in shell command lines
" executed from Vim's command mode, refer to `:help :!' for
" details.
let cmd = printf('start /b %s', escape(cmd, "\\\n!%#"))
elseif has('unix')
let cmd = printf('(%s) &', cmd)
else
Expand Down

0 comments on commit 3e6b8fb

Please sign in to comment.