Do not try to run tty command if it doesn't exist

Signed-off-by: James McCoy <jamessan@jamessan.com>
This commit is contained in:
James McCoy
2019-08-23 19:02:29 -04:00
parent c2c9720584
commit 5001a8b45d

View File

@@ -213,6 +213,7 @@ function gnupg#init(bufread)
" modified just by detecting the correct tty value. " modified just by detecting the correct tty value.
" Do the &undolevels dance so the :read and :delete don't get added into " Do the &undolevels dance so the :read and :delete don't get added into
" the undo tree, as the user needn't be aware of these. " the undo tree, as the user needn't be aware of these.
if executable('tty')
let [mod, levels] = [&l:modified, &undolevels] let [mod, levels] = [&l:modified, &undolevels]
set undolevels=-1 set undolevels=-1
silent read !tty silent read !tty
@@ -221,10 +222,11 @@ function gnupg#init(bufread)
let [&l:modified, &undolevels] = [mod, levels] let [&l:modified, &undolevels] = [mod, levels]
" redraw is needed since we're using silent to run !tty, c.f. :help :! " redraw is needed since we're using silent to run !tty, c.f. :help :!
redraw! redraw!
if (v:shell_error) endif
if v:shell_error || !exists("$GPG_TTY")
let $GPG_TTY = "" let $GPG_TTY = ""
echohl GPGWarning echohl GPGWarning
echom "$GPG_TTY is not set and the `tty` command failed! gpg-agent might not work." echom "$GPG_TTY is not set and the `tty` command failed/doesn't exist! gpg-agent might not work."
echohl None echohl None
endif endif
endif endif