|
1 | 1 | " Operating system interfaces.
|
2 | 2 | "
|
3 | 3 | " Author: Peter Odding <[email protected]>
|
4 |
| -" Last Change: June , 2013 |
| 4 | +" Last Change: May 21, 2015 |
5 | 5 | " URL: http://peterodding.com/code/vim/misc/
|
6 | 6 |
|
7 | 7 | function! xolox#misc#os#is_mac() " {{{1
|
@@ -158,7 +158,20 @@ function! xolox#misc#os#exec(options) " {{{1
|
158 | 158 | " Enable asynchronous mode (very platform specific).
|
159 | 159 | if async
|
160 | 160 | if is_win
|
161 |
| - let cmd = printf('start /b %s', cmd) |
| 161 | + " As pointed out in issue 17 [1] the use of `:!start' on Windows |
| 162 | + " requires characters like `!', `%' and `#' to be escaped with a |
| 163 | + " backslash [2]. Vim's shellescape() function knows how to escape |
| 164 | + " these special characters however the use of `:!start' is an |
| 165 | + " implementation detail of xolox#misc#os#exec() so I don't want to |
| 166 | + " bother callers (who perform the shell escaping) with such a |
| 167 | + " specific implementation detail. This is why I resort to manually |
| 168 | + " escaping characters documented to have a special meaning [2]. |
| 169 | + " |
| 170 | + " [1] https://github.com/xolox/vim-misc/issues/17 |
| 171 | + " [2] All characters interpreted specially in shell command lines |
| 172 | + " executed from Vim's command mode, refer to `:help :!' for |
| 173 | + " details. |
| 174 | + let cmd = printf('start /b %s', escape(cmd, "\\\n!%#")) |
162 | 175 | elseif has('unix')
|
163 | 176 | let cmd = printf('(%s) &', cmd)
|
164 | 177 | else
|
|
0 commit comments