vim-patch:8.1.2133: some tests fail when run as root

Problem:    Some tests fail when run as root.
Solution:   Add CheckNotRoot and use it. (James McCoy, closes vim/vim#5020)
07282f01da

Skip test_terminal.vim and test_viminfo.vim: N/A
This commit is contained in:
zeertzjq
2022-02-04 21:52:44 +08:00
parent cb863d4e1f
commit 041b2d6f1e
4 changed files with 32 additions and 9 deletions

View File

@@ -343,6 +343,15 @@ func RunVimPiped(before, after, arguments, pipecmd)
return 1
endfunc
func IsRoot()
if !has('unix')
return v:false
elseif $USER == 'root' || system('id -un') =~ '\<root\>'
return v:true
endif
return v:false
endfunc
" Get all messages but drop the maintainer entry.
func GetMessages()
redir => result