mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-03 00:22:51 +08:00
Fix #1716 - Replace tempdir() with a wrapper to preserve TMPDIR
This commit is contained in:
@@ -277,6 +277,25 @@ function! ale#util#InSandbox() abort
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! ale#util#Tempname() abort
|
||||
let l:clear_tempdir = 0
|
||||
|
||||
if has('unix') && empty($TMPDIR)
|
||||
let l:clear_tempdir = 1
|
||||
let $TMPDIR = '/tmp'
|
||||
endif
|
||||
|
||||
try
|
||||
let l:name = tempname() " no-custom-checks
|
||||
finally
|
||||
if l:clear_tempdir
|
||||
let $TMPDIR = ''
|
||||
endif
|
||||
endtry
|
||||
|
||||
return l:name
|
||||
endfunction
|
||||
|
||||
" Given a single line, or a List of lines, and a single pattern, or a List
|
||||
" of patterns, return all of the matches for the lines(s) from the given
|
||||
" patterns, using matchlist().
|
||||
|
||||
Reference in New Issue
Block a user