From c528ab1eaa2fa951bde708a094274a4a05e03ebb Mon Sep 17 00:00:00 2001 From: w0rp Date: Fri, 10 Feb 2017 09:45:42 +0000 Subject: [PATCH] Fix #269 Set $TMPDIR to a default value, if not set --- plugin/ale.vim | 6 ++++++ test/test_tmpdir_init.vader | 2 ++ test/vimrc | 4 ++++ 3 files changed, 12 insertions(+) create mode 100644 test/test_tmpdir_init.vader diff --git a/plugin/ale.vim b/plugin/ale.vim index 780d37e0..d65a99cb 100644 --- a/plugin/ale.vim +++ b/plugin/ale.vim @@ -25,6 +25,12 @@ if !s:has_features finish endif +" Set the TMPDIR environment variable if it is not set automatically. +" This can automatically fix some environments. +if has('unix') && empty($TMPDIR) + let $TMPDIR = '/tmp' +endif + " This global variable is used internally by ALE for tracking information for " each buffer which linters are being run against. let g:ale_buffer_info = {} diff --git a/test/test_tmpdir_init.vader b/test/test_tmpdir_init.vader new file mode 100644 index 00000000..68bb2b43 --- /dev/null +++ b/test/test_tmpdir_init.vader @@ -0,0 +1,2 @@ +Execute($TMPDIR should be set to a default value if unset): + AssertEqual '/tmp', $TMPDIR diff --git a/test/vimrc b/test/vimrc index 77be5e29..ef678848 100644 --- a/test/vimrc +++ b/test/vimrc @@ -20,3 +20,7 @@ set foldnestmax=10 set ttimeoutlen=0 let g:mapleader=',' + +" Clear the TMPDIR value for tests. +" The plugin should set this to /tmp by default, which we will test. +let $TMPDIR = ''