Fix a bug related to shell escaping.

This commit is contained in:
LCD 47 2013-07-10 10:30:41 +03:00
parent eeec03d19d
commit a1e1108c8e
3 changed files with 7 additions and 7 deletions

View File

@ -156,7 +156,7 @@ endfunction
" A less noisy shellescape()
function! syntastic#util#shescape(string)
return a:string =~ '\m^[A-Za-z0-9_/.-]\+$' ? a:string : shellescape(a:string)
return a:string =~ '\m^[A-Za-z0-9_/.-]\+$' ? a:string : shellescape(a:string, 1)
endfunction
" A less noisy shellescape(expand())

View File

@ -33,7 +33,7 @@ function! SyntaxCheckers_eruby_erb_GetLocList()
let exe = 'RUBYOPT= ' . exe
endif
let fname = fnameescape(expand('%'))
let fname = "'" . escape(expand('%'), "\\'") . "'"
let enc = &fileencoding != '' ? &fileencoding : &encoding
let encoding_string = enc ==? 'utf-8' ? 'UTF-8' : 'BINARY'
@ -41,8 +41,8 @@ function! SyntaxCheckers_eruby_erb_GetLocList()
" TODO: fix the encoding trainwreck
let makeprg =
\ exe . ' -e ' .
\ syntastic#util#shescape('puts File.read("' . fname .
\ '", :encoding => "' . encoding_string .
\ syntastic#util#shescape('puts File.read(' . fname .
\ ', :encoding => "' . encoding_string .
\ '").gsub(''<\%='',''<\%'')') .
\ ' \| ' . g:syntastic_erb_exec . ' -x -T -' .
\ ' \| ' . exe . ' -c'

View File

@ -29,7 +29,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList()
let exe = 'RUBYOPT= ' . exe
endif
let fname = fnameescape(expand('%'))
let fname = "'" . escape(expand('%'), "\\'") . "'"
let enc = &fileencoding != '' ? &fileencoding : &encoding
let encoding_string = enc ==? 'utf-8' ? 'UTF-8' : 'BINARY'
@ -37,8 +37,8 @@ function! SyntaxCheckers_eruby_ruby_GetLocList()
"gsub fixes issue #7, rails has it's own eruby syntax
let makeprg =
\ exe . ' -rerb -e ' .
\ syntastic#util#shescape('puts ERB.new(File.read("' . fname .
\ '", :encoding => "' . encoding_string .
\ syntastic#util#shescape('puts ERB.new(File.read(' . fname .
\ ', :encoding => "' . encoding_string .
\ '").gsub(''<\%='',''<\%''), nil, ''-'').src') .
\ ' \| ' . exe . ' -c'