ssh kitten: Fix location of generated terminfo files on NetBSD

Fixes #4622
This commit is contained in:
Kovid Goyal 2022-02-03 19:51:37 +05:30
parent 34a0218f35
commit 53589c3954
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 12 additions and 3 deletions

View File

@ -80,6 +80,8 @@ Detailed list of changes
- Fix a regression in the previous release that broke :opt:`active_tab_foreground` (:iss:`4620`)
- ssh kitten: Fix location of generated terminfo files on NetBSD (:iss:`4622`)
0.24.2 [2022-02-03]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -20,12 +20,16 @@
TERMINFO
TERMEOF
tic_out=$(tic -x -o $HOME/.terminfo $tmp 2>&1)
tname=.terminfo
if [ -e "/usr/share/misc/terminfo.cdb" ]; then
tname=".terminfo.cdb"
fi
tic_out=$(tic -x -o $HOME/$tname $tmp 2>&1)
rc=$?
rm $tmp
if [ "$rc" != "0" ]; then echo "$tic_out"; exit 1; fi
if [ -z "$USER" ]; then export USER=$(whoami); fi
export TERMINFO="$HOME/.terminfo"
export TERMINFO="$HOME/$tname"
login_shell=""
python=""
@ -109,8 +113,11 @@
# macOS ships with an ancient version of tic that cannot read from stdin, so we
# create a temp file for it
with NamedTemporaryFile() as tmp:
tname = '.terminfo'
if os.path.exists('/usr/share/misc/terminfo.cdb'):
tname += '.cdb'
tmp.write(binascii.unhexlify('{terminfo}'))
p = subprocess.Popen(['tic', '-x', '-o', os.path.expanduser('~/.terminfo'), tmp.name], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p = subprocess.Popen(['tic', '-x', '-o', os.path.expanduser('~/' + tname), tmp.name], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
if p.wait() != 0:
getattr(sys.stderr, 'buffer', sys.stderr).write(stdout + stderr)