diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 85ec7c01..db52d7f2 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -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()) diff --git a/syntax_checkers/eruby/erb.vim b/syntax_checkers/eruby/erb.vim index 06ac79bb..e37bba26 100644 --- a/syntax_checkers/eruby/erb.vim +++ b/syntax_checkers/eruby/erb.vim @@ -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' diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index e9503f7e..6032bc22 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -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'