diff src/testdir/test_terminal.vim @ 14995:bc0f3c4fb992 v8.1.0509

patch 8.1.0509: checking cwd not accessible fails for root commit https://github.com/vim/vim/commit/0b38f54730c3f9835ddade01c2263ce0f56c1c0f Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 3 21:47:16 2018 +0100 patch 8.1.0509: checking cwd not accessible fails for root Problem: Checking cwd not accessible fails for root. (James McCoy) Solution: Skip this part of the test for root. (closes https://github.com/vim/vim/issues/3595)
author Bram Moolenaar <Bram@vim.org>
date Sat, 03 Nov 2018 22:00:06 +0100
parents cb07193c6257
children f3b4cd98944c
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -490,14 +490,17 @@ func Test_terminal_cwd_failure()
   call assert_fails("call term_start(&shell, {'cwd': 'Xdir'})", 'E475:')
 
   " Case 3: Directory exists but is not accessible.
-  call mkdir('Xdir', '', '0600')
-  " return early if the directory permissions could not be set properly
-  if getfperm('Xdir')[2] == 'x'
-    call delete('Xdir', 'rf')
-    return
+  " Skip this for root, it will be accessible anyway.
+  if $USER != 'root'
+    call mkdir('XdirNoAccess', '', '0600')
+    " return early if the directory permissions could not be set properly
+    if getfperm('XdirNoAccess')[2] == 'x'
+      call delete('XdirNoAccess', 'rf')
+      return
+    endif
+    call assert_fails("call term_start(&shell, {'cwd': 'XdirNoAccess'})", 'E475:')
+    call delete('XdirNoAccess', 'rf')
   endif
-  call assert_fails("call term_start(&shell, {'cwd': 'Xdir'})", 'E475:')
-  call delete('Xdir', 'rf')
 endfunc
 
 func Test_terminal_servername()