#549 Temporarily revert shell escaping changes, just for Windows

This commit is contained in:
w0rp 2017-05-12 09:20:16 +01:00
parent fa54f7af97
commit 07b2542c0d
30 changed files with 51 additions and 40 deletions

View file

@ -5,7 +5,7 @@ let g:ale_asm_gcc_options = get(g:, 'ale_asm_gcc_options', '-Wall')
function! ale_linters#asm#gcc#GetCommand(buffer) abort function! ale_linters#asm#gcc#GetCommand(buffer) abort
return 'gcc -x assembler -fsyntax-only ' return 'gcc -x assembler -fsyntax-only '
\ . '-iquote ' . shellescape(fnamemodify(bufname(a:buffer), ':p:h')) \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -' \ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
endfunction endfunction

View file

@ -13,7 +13,7 @@ function! ale_linters#c#clang#GetCommand(buffer) abort
" -iquote with the directory the file is in makes #include work for " -iquote with the directory the file is in makes #include work for
" headers in the same directory. " headers in the same directory.
return 'clang -S -x c -fsyntax-only ' return 'clang -S -x c -fsyntax-only '
\ . '-iquote ' . shellescape(fnamemodify(bufname(a:buffer), ':p:h')) \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
\ . ' ' . ale#Var(a:buffer, 'c_clang_options') . ' -' \ . ' ' . ale#Var(a:buffer, 'c_clang_options') . ' -'
endfunction endfunction

View file

@ -13,7 +13,7 @@ function! ale_linters#c#gcc#GetCommand(buffer) abort
" -iquote with the directory the file is in makes #include work for " -iquote with the directory the file is in makes #include work for
" headers in the same directory. " headers in the same directory.
return 'gcc -S -x c -fsyntax-only ' return 'gcc -S -x c -fsyntax-only '
\ . '-iquote ' . shellescape(fnamemodify(bufname(a:buffer), ':p:h')) \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
\ . ' ' . ale#Var(a:buffer, 'c_gcc_options') . ' -' \ . ' ' . ale#Var(a:buffer, 'c_gcc_options') . ' -'
endfunction endfunction

View file

@ -10,7 +10,7 @@ function! ale_linters#cpp#clang#GetCommand(buffer) abort
" -iquote with the directory the file is in makes #include work for " -iquote with the directory the file is in makes #include work for
" headers in the same directory. " headers in the same directory.
return 'clang++ -S -x c++ -fsyntax-only ' return 'clang++ -S -x c++ -fsyntax-only '
\ . '-iquote ' . shellescape(fnamemodify(bufname(a:buffer), ':p:h')) \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
\ . ' ' . ale#Var(a:buffer, 'cpp_clang_options') . ' -' \ . ' ' . ale#Var(a:buffer, 'cpp_clang_options') . ' -'
endfunction endfunction

View file

@ -11,7 +11,7 @@ let g:ale_cpp_clangtidy_options = get(g:, 'ale_cpp_clangtidy_options', '')
function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort
let l:check_list = ale#Var(a:buffer, 'cpp_clangtidy_checks') let l:check_list = ale#Var(a:buffer, 'cpp_clangtidy_checks')
let l:check_option = !empty(l:check_list) let l:check_option = !empty(l:check_list)
\ ? '-checks=' . shellescape(join(l:check_list, ',')) . ' ' \ ? '-checks=' . ale#Escape(join(l:check_list, ',')) . ' '
\ : '' \ : ''
let l:user_options = ale#Var(a:buffer, 'cpp_clangtidy_options') let l:user_options = ale#Var(a:buffer, 'cpp_clangtidy_options')
let l:extra_options = !empty(l:user_options) let l:extra_options = !empty(l:user_options)

View file

@ -20,7 +20,7 @@ function! ale_linters#cpp#gcc#GetCommand(buffer) abort
" -iquote with the directory the file is in makes #include work for " -iquote with the directory the file is in makes #include work for
" headers in the same directory. " headers in the same directory.
return 'gcc -S -x c++ -fsyntax-only ' return 'gcc -S -x c++ -fsyntax-only '
\ . '-iquote ' . shellescape(fnamemodify(bufname(a:buffer), ':p:h')) \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
\ . ' ' . ale#Var(a:buffer, 'cpp_gcc_options') . ' -' \ . ' ' . ale#Var(a:buffer, 'cpp_gcc_options') . ' -'
endfunction endfunction

View file

@ -25,7 +25,7 @@ endfunction
function! ale_linters#crystal#crystal#GetCommand(buffer) abort function! ale_linters#crystal#crystal#GetCommand(buffer) abort
let l:crystal_cmd = 'crystal build -f json --no-codegen -o ' let l:crystal_cmd = 'crystal build -f json --no-codegen -o '
let l:crystal_cmd .= shellescape(g:ale#util#nul_file) let l:crystal_cmd .= ale#Escape(g:ale#util#nul_file)
let l:crystal_cmd .= ' %s' let l:crystal_cmd .= ' %s'
return l:crystal_cmd return l:crystal_cmd

View file

@ -4,7 +4,7 @@
function! ale_linters#css#csslint#GetCommand(buffer) abort function! ale_linters#css#csslint#GetCommand(buffer) abort
let l:csslintrc = ale#path#FindNearestFile(a:buffer, '.csslintrc') let l:csslintrc = ale#path#FindNearestFile(a:buffer, '.csslintrc')
let l:config_option = !empty(l:csslintrc) let l:config_option = !empty(l:csslintrc)
\ ? '--config=' . shellescape(l:csslintrc) \ ? '--config=' . ale#Escape(l:csslintrc)
\ : '' \ : ''
return 'csslint --format=compact ' . l:config_option . ' %t' return 'csslint --format=compact ' . l:config_option . ' %t'

View file

@ -31,7 +31,7 @@ function! ale_linters#d#dmd#DUBCommand(buffer) abort
" To support older dub versions, we just change the directory to " To support older dub versions, we just change the directory to
" the directory where we found the dub config, and then run `dub describe` " the directory where we found the dub config, and then run `dub describe`
" from that directory. " from that directory.
return 'cd ' . shellescape(fnamemodify(l:dub_file, ':h')) return 'cd ' . ale#Escape(fnamemodify(l:dub_file, ':h'))
\ . ' && dub describe --import-paths' \ . ' && dub describe --import-paths'
endfunction endfunction
@ -42,7 +42,7 @@ function! ale_linters#d#dmd#DMDCommand(buffer, dub_output) abort
for l:line in a:dub_output for l:line in a:dub_output
if !empty(l:line) if !empty(l:line)
" The arguments must be '-Ifilename', not '-I filename' " The arguments must be '-Ifilename', not '-I filename'
call add(l:import_list, '-I' . shellescape(l:line)) call add(l:import_list, '-I' . ale#Escape(l:line))
endif endif
endfor endfor

View file

@ -43,14 +43,14 @@ function! ale_linters#elm#make#GetCommand(buffer) abort
let l:dir_set_cmd = '' let l:dir_set_cmd = ''
else else
let l:root_dir = fnamemodify(l:elm_package, ':p:h') let l:root_dir = fnamemodify(l:elm_package, ':p:h')
let l:dir_set_cmd = 'cd ' . shellescape(l:root_dir) . ' && ' let l:dir_set_cmd = 'cd ' . ale#Escape(l:root_dir) . ' && '
endif endif
" The elm-make compiler, at the time of this writing, uses '/dev/null' as " The elm-make compiler, at the time of this writing, uses '/dev/null' as
" a sort of flag to tell the compiler not to generate an output file, " a sort of flag to tell the compiler not to generate an output file,
" which is why this is hard coded here. " which is why this is hard coded here.
" Source: https://github.com/elm-lang/elm-make/blob/master/src/Flags.hs " Source: https://github.com/elm-lang/elm-make/blob/master/src/Flags.hs
let l:elm_cmd = 'elm-make --report=json --output='.shellescape('/dev/null') let l:elm_cmd = 'elm-make --report=json --output='.ale#Escape('/dev/null')
return l:dir_set_cmd . ' ' . l:elm_cmd . ' %t' return l:dir_set_cmd . ' ' . l:elm_cmd . ' %t'
endfunction endfunction

View file

@ -6,7 +6,7 @@ function! ale_linters#erlang#erlc#GetCommand(buffer) abort
let l:output_file = tempname() let l:output_file = tempname()
call ale#engine#ManageFile(a:buffer, l:output_file) call ale#engine#ManageFile(a:buffer, l:output_file)
return 'erlc -o ' . shellescape(l:output_file) return 'erlc -o ' . ale#Escape(l:output_file)
\ . ' ' . ale#Var(a:buffer, 'erlang_erlc_options') \ . ' ' . ale#Var(a:buffer, 'erlang_erlc_options')
\ . ' %t' \ . ' %t'
endfunction endfunction

View file

@ -8,7 +8,7 @@ endif
function! ale_linters#go#gometalinter#GetCommand(buffer) abort function! ale_linters#go#gometalinter#GetCommand(buffer) abort
return 'gometalinter ' return 'gometalinter '
\ . ale#Var(a:buffer, 'go_gometalinter_options') \ . ale#Var(a:buffer, 'go_gometalinter_options')
\ . ' ' . shellescape(fnamemodify(bufname(a:buffer), ':p:h')) \ . ' ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
endfunction endfunction
function! ale_linters#go#gometalinter#GetMatches(lines) abort function! ale_linters#go#gometalinter#GetMatches(lines) abort

View file

@ -47,7 +47,7 @@ function! s:BuildClassPathOption(buffer, import_paths) abort
\) \)
return !empty(l:class_paths) return !empty(l:class_paths)
\ ? '-cp ' . shellescape(join(l:class_paths, s:classpath_sep)) \ ? '-cp ' . ale#Escape(join(l:class_paths, s:classpath_sep))
\ : '' \ : ''
endfunction endfunction
@ -64,7 +64,7 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort
let l:src_dir = ale#path#FindNearestDirectory(a:buffer, 'src/main/java') let l:src_dir = ale#path#FindNearestDirectory(a:buffer, 'src/main/java')
if !empty(l:src_dir) if !empty(l:src_dir)
let l:sp_option = '-sourcepath ' . shellescape(l:src_dir) let l:sp_option = '-sourcepath ' . ale#Escape(l:src_dir)
endif endif
" Create .class files in a temporary directory, which we will delete later. " Create .class files in a temporary directory, which we will delete later.
@ -73,7 +73,7 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort
return 'javac -Xlint' return 'javac -Xlint'
\ . ' ' . l:cp_option \ . ' ' . l:cp_option
\ . ' ' . l:sp_option \ . ' ' . l:sp_option
\ . ' -d ' . shellescape(l:class_file_directory) \ . ' -d ' . ale#Escape(l:class_file_directory)
\ . ' ' . ale#Var(a:buffer, 'java_javac_options') \ . ' ' . ale#Var(a:buffer, 'java_javac_options')
\ . ' %t' \ . ' %t'
endfunction endfunction

View file

@ -34,7 +34,7 @@ function! ale_linters#javascript#eslint#GetExecutable(buffer) abort
endfunction endfunction
function! ale_linters#javascript#eslint#GetCommand(buffer) abort function! ale_linters#javascript#eslint#GetCommand(buffer) abort
return shellescape(ale_linters#javascript#eslint#GetExecutable(a:buffer)) return ale#Escape(ale_linters#javascript#eslint#GetExecutable(a:buffer))
\ . ' ' . ale#Var(a:buffer, 'javascript_eslint_options') \ . ' ' . ale#Var(a:buffer, 'javascript_eslint_options')
\ . ' -f unix --stdin --stdin-filename %s' \ . ' -f unix --stdin --stdin-filename %s'
endfunction endfunction

View file

@ -27,7 +27,7 @@ function! ale_linters#javascript#flow#GetCommand(buffer) abort
return '' return ''
endif endif
return shellescape(ale_linters#javascript#flow#GetExecutable(a:buffer)) return ale#Escape(ale_linters#javascript#flow#GetExecutable(a:buffer))
\ . ' check-contents --respect-pragma --json --from ale %s' \ . ' check-contents --respect-pragma --json --from ale %s'
endfunction endfunction

View file

@ -27,11 +27,11 @@ function! ale_linters#javascript#jshint#GetCommand(buffer) abort
\ get(g:, 'ale_jshint_config_loc', '') \ get(g:, 'ale_jshint_config_loc', '')
\) \)
let l:command = shellescape(ale_linters#javascript#jshint#GetExecutable(a:buffer)) let l:command = ale#Escape(ale_linters#javascript#jshint#GetExecutable(a:buffer))
let l:command .= ' --reporter unix --extract auto' let l:command .= ' --reporter unix --extract auto'
if !empty(l:jshint_config) if !empty(l:jshint_config)
let l:command .= ' --config ' . shellescape(l:jshint_config) let l:command .= ' --config ' . ale#Escape(l:jshint_config)
endif endif
let l:command .= ' -' let l:command .= ' -'

View file

@ -23,7 +23,7 @@ function! ale_linters#javascript#standard#GetExecutable(buffer) abort
endfunction endfunction
function! ale_linters#javascript#standard#GetCommand(buffer) abort function! ale_linters#javascript#standard#GetCommand(buffer) abort
return shellescape(ale_linters#javascript#standard#GetExecutable(a:buffer)) return ale#Escape(ale_linters#javascript#standard#GetExecutable(a:buffer))
\ . ' ' . ale#Var(a:buffer, 'javascript_standard_options') \ . ' ' . ale#Var(a:buffer, 'javascript_standard_options')
\ . ' --stdin %s' \ . ' --stdin %s'
endfunction endfunction

View file

@ -23,7 +23,7 @@ function! ale_linters#javascript#xo#GetExecutable(buffer) abort
endfunction endfunction
function! ale_linters#javascript#xo#GetCommand(buffer) abort function! ale_linters#javascript#xo#GetCommand(buffer) abort
return shellescape(ale_linters#javascript#xo#GetExecutable(a:buffer)) return ale#Escape(ale_linters#javascript#xo#GetExecutable(a:buffer))
\ . ' ' . ale#Var(a:buffer, 'javascript_xo_options') \ . ' ' . ale#Var(a:buffer, 'javascript_xo_options')
\ . ' --reporter unix --stdin --stdin-filename %s' \ . ' --reporter unix --stdin --stdin-filename %s'
endfunction endfunction

View file

@ -16,13 +16,13 @@ function! ale_linters#kotlin#kotlinc#GetCommand(buffer) abort
" If the config file is enabled and readable, source it " If the config file is enabled and readable, source it
if ale#Var(a:buffer, 'kotlin_kotlinc_enable_config') if ale#Var(a:buffer, 'kotlin_kotlinc_enable_config')
if filereadable(expand(ale#Var(a:buffer, 'kotlin_kotlinc_config_file'), 1)) if filereadable(expand(ale#Var(a:buffer, 'kotlin_kotlinc_config_file'), 1))
execute 'source ' . shellescape(expand(ale#Var(a:buffer, 'kotlin_kotlinc_config_file'), 1)) execute 'source ' . ale#Escape(expand(ale#Var(a:buffer, 'kotlin_kotlinc_config_file'), 1))
endif endif
endif endif
" If use module and module file is readable use that and return " If use module and module file is readable use that and return
if ale#Var(a:buffer, 'kotlin_kotlinc_use_module_file') if ale#Var(a:buffer, 'kotlin_kotlinc_use_module_file')
let l:module_filename = shellescape(expand(ale#Var(a:buffer, 'kotlin_kotlinc_module_filename'), 1)) let l:module_filename = ale#Escape(expand(ale#Var(a:buffer, 'kotlin_kotlinc_module_filename'), 1))
if filereadable(l:module_filename) if filereadable(l:module_filename)
let l:kotlinc_opts .= ' -module ' . l:module_filename let l:kotlinc_opts .= ' -module ' . l:module_filename
@ -42,7 +42,7 @@ function! ale_linters#kotlin#kotlinc#GetCommand(buffer) abort
if ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath') !=# '' if ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath') !=# ''
let l:fname .= expand(ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath'), 1) . ' ' let l:fname .= expand(ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath'), 1) . ' '
endif endif
let l:fname .= shellescape(expand('#' . a:buffer . ':p')) let l:fname .= ale#Escape(expand('#' . a:buffer . ':p'))
let l:command .= l:kotlinc_opts . ' ' . l:fname let l:command .= l:kotlinc_opts . ' ' . l:fname
return l:command return l:command

View file

@ -12,7 +12,7 @@ function! ale_linters#lua#luacheck#GetExecutable(buffer) abort
endfunction endfunction
function! ale_linters#lua#luacheck#GetCommand(buffer) abort function! ale_linters#lua#luacheck#GetCommand(buffer) abort
return shellescape(ale_linters#lua#luacheck#GetExecutable(a:buffer)) return ale#Escape(ale_linters#lua#luacheck#GetExecutable(a:buffer))
\ . ' ' . ale#Var(a:buffer, 'lua_luacheck_options') \ . ' ' . ale#Var(a:buffer, 'lua_luacheck_options')
\ . ' --formatter plain --codes --filename %s -' \ . ' --formatter plain --codes --filename %s -'
endfunction endfunction

View file

@ -44,7 +44,7 @@ endfunction
function! ale_linters#nim#nimcheck#GetCommand(buffer) abort function! ale_linters#nim#nimcheck#GetCommand(buffer) abort
let l:directory = shellescape(fnamemodify(bufname(a:buffer), ':p:h')) let l:directory = ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
return 'nim check --path:' . l:directory return 'nim check --path:' . l:directory
\ . ' --threads:on --verbosity:0 --colors:off --listFullPaths %t' \ . ' --threads:on --verbosity:0 --colors:off --listFullPaths %t'

View file

@ -48,7 +48,7 @@ function! ale_linters#python#flake8#VersionCheck(buffer) abort
return '' return ''
endif endif
let l:executable = shellescape(ale_linters#python#flake8#GetExecutable(a:buffer)) let l:executable = ale#Escape(ale_linters#python#flake8#GetExecutable(a:buffer))
let l:module_string = s:UsingModule(a:buffer) ? ' -m flake8' : '' let l:module_string = s:UsingModule(a:buffer) ? ' -m flake8' : ''
return l:executable . l:module_string . ' --version' return l:executable . l:module_string . ' --version'
@ -89,7 +89,7 @@ function! ale_linters#python#flake8#GetCommand(buffer, version_output) abort
let l:options = ale#Var(a:buffer, 'python_flake8_options') let l:options = ale#Var(a:buffer, 'python_flake8_options')
return shellescape(ale_linters#python#flake8#GetExecutable(a:buffer)) return ale#Escape(ale_linters#python#flake8#GetExecutable(a:buffer))
\ . (!empty(l:options) ? ' ' . l:options : '') \ . (!empty(l:options) ? ' ' . l:options : '')
\ . l:display_name_args . ' -' \ . l:display_name_args . ' -'
endfunction endfunction

View file

@ -30,7 +30,7 @@ function! ale_linters#python#mypy#GetCommand(buffer) abort
let l:executable = ale_linters#python#mypy#GetExecutable(a:buffer) let l:executable = ale_linters#python#mypy#GetExecutable(a:buffer)
return l:cd_command return l:cd_command
\ . shellescape(l:executable) \ . ale#Escape(l:executable)
\ . ' --show-column-numbers ' \ . ' --show-column-numbers '
\ . ale#Var(a:buffer, 'python_mypy_options') \ . ale#Var(a:buffer, 'python_mypy_options')
\ . ' %s' \ . ' %s'

View file

@ -26,7 +26,7 @@ function! ale_linters#python#pylint#GetExecutable(buffer) abort
endfunction endfunction
function! ale_linters#python#pylint#GetCommand(buffer) abort function! ale_linters#python#pylint#GetCommand(buffer) abort
return shellescape(ale_linters#python#pylint#GetExecutable(a:buffer)) return ale#Escape(ale_linters#python#pylint#GetExecutable(a:buffer))
\ . ' ' . ale#Var(a:buffer, 'python_pylint_options') \ . ' ' . ale#Var(a:buffer, 'python_pylint_options')
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n' \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n'
\ . ' %s' \ . ' %s'

View file

@ -18,7 +18,7 @@ function! ale_linters#tex#chktex#GetCommand(buffer) abort
let l:command .= ' -v0 -p stdin -q' let l:command .= ' -v0 -p stdin -q'
if !empty(l:chktex_config) if !empty(l:chktex_config)
let l:command .= ' -l ' . shellescape(l:chktex_config) let l:command .= ' -l ' . ale#Escape(l:chktex_config)
endif endif
let l:command .= ' ' . ale#Var(a:buffer, 'tex_chktex_options') let l:command .= ' ' . ale#Var(a:buffer, 'tex_chktex_options')

View file

@ -55,7 +55,7 @@ function! ale_linters#typescript#tslint#BuildLintCommand(buffer) abort
\) \)
let l:tslint_config_option = !empty(l:tslint_config_path) let l:tslint_config_option = !empty(l:tslint_config_path)
\ ? '-c ' . shellescape(l:tslint_config_path) \ ? '-c ' . ale#Escape(l:tslint_config_path)
\ : '' \ : ''
return ale_linters#typescript#tslint#GetExecutable(a:buffer) return ale_linters#typescript#tslint#GetExecutable(a:buffer)

View file

@ -8,7 +8,7 @@ function! ale_linters#verilog#verilator#GetCommand(buffer) abort
call ale#engine#ManageFile(a:buffer, l:filename) call ale#engine#ManageFile(a:buffer, l:filename)
call writefile(getbufline(a:buffer, 1, '$'), l:filename) call writefile(getbufline(a:buffer, 1, '$'), l:filename)
return 'verilator --lint-only -Wall -Wno-DECLFILENAME ' . shellescape(l:filename) return 'verilator --lint-only -Wall -Wno-DECLFILENAME ' . ale#Escape(l:filename)
endfunction endfunction
function! ale_linters#verilog#verilator#Handle(buffer, lines) abort function! ale_linters#verilog#verilator#Handle(buffer, lines) abort

View file

@ -123,3 +123,14 @@ function! ale#Var(buffer, variable_name) abort
return getbufvar(str2nr(a:buffer), l:full_name, g:[l:full_name]) return getbufvar(str2nr(a:buffer), l:full_name, g:[l:full_name])
endfunction endfunction
" Escape a string suitably for each platform.
" shellescape() does not work on Windows.
function! ale#Escape(str) abort
if fnamemodify(&shell, ':t') ==? 'cmd.exe'
" FIXME: Fix shell escaping for Windows.
return fnameescape(a:str)
else
return shellescape(a:str)
endif
endfunction

View file

@ -480,14 +480,14 @@ function! ale#engine#FormatCommand(buffer, command) abort
" file. " file.
if l:command =~# '%s' if l:command =~# '%s'
let l:filename = fnamemodify(bufname(a:buffer), ':p') let l:filename = fnamemodify(bufname(a:buffer), ':p')
let l:command = substitute(l:command, '%s', '\=shellescape(l:filename)', 'g') let l:command = substitute(l:command, '%s', '\=ale#Escape(l:filename)', 'g')
endif endif
if l:command =~# '%t' if l:command =~# '%t'
" Create a temporary filename, <temp_dir>/<original_basename> " Create a temporary filename, <temp_dir>/<original_basename>
" The file itself will not be created by this function. " The file itself will not be created by this function.
let l:temporary_file = s:TemporaryFilename(a:buffer) let l:temporary_file = s:TemporaryFilename(a:buffer)
let l:command = substitute(l:command, '%t', '\=shellescape(l:temporary_file)', 'g') let l:command = substitute(l:command, '%t', '\=ale#Escape(l:temporary_file)', 'g')
endif endif
" Finish formatting so %% becomes %. " Finish formatting so %% becomes %.
@ -529,7 +529,7 @@ function! s:RunJob(options) abort
" in the shell. We'll write out the file to a temporary file, " in the shell. We'll write out the file to a temporary file,
" and then read it back in, in the shell. " and then read it back in, in the shell.
let l:temporary_file = s:TemporaryFilename(l:buffer) let l:temporary_file = s:TemporaryFilename(l:buffer)
let l:command = l:command . ' < ' . shellescape(l:temporary_file) let l:command = l:command . ' < ' . ale#Escape(l:temporary_file)
endif endif
if s:CreateTemporaryFileForJob(l:buffer, l:temporary_file) if s:CreateTemporaryFileForJob(l:buffer, l:temporary_file)
@ -636,7 +636,7 @@ function! s:RunJob(options) abort
" Run a command synchronously if this test option is set. " Run a command synchronously if this test option is set.
let s:job_info_map[l:job_id].output = systemlist( let s:job_info_map[l:job_id].output = systemlist(
\ type(l:command) == type([]) \ type(l:command) == type([])
\ ? join(l:command[0:1]) . ' ' . shellescape(l:command[2]) \ ? join(l:command[0:1]) . ' ' . ale#Escape(l:command[2])
\ : l:command \ : l:command
\) \)
call s:HandleExit(l:job) call s:HandleExit(l:job)

View file

@ -47,7 +47,7 @@ endfunction
" Output 'cd <directory> && ' " Output 'cd <directory> && '
" This function can be used changing the directory for a linter command. " This function can be used changing the directory for a linter command.
function! ale#path#CdString(directory) abort function! ale#path#CdString(directory) abort
return 'cd ' . shellescape(a:directory) . ' && ' return 'cd ' . ale#Escape(a:directory) . ' && '
endfunction endfunction
" Output 'cd <buffer_filename_directory> && ' " Output 'cd <buffer_filename_directory> && '