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() " A less noisy shellescape()
function! syntastic#util#shescape(string) 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 endfunction
" A less noisy shellescape(expand()) " A less noisy shellescape(expand())

View File

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

View File

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