mirror of
https://github.com/nix-community/nix-direnv.git
synced 2025-11-08 19:46:11 +01:00
Restore terminfo from calling shell
This commit is contained in:
parent
a59f38b53c
commit
875a7a9a52
1 changed files with 12 additions and 10 deletions
22
direnvrc
22
direnvrc
|
|
@ -131,11 +131,14 @@ _nix_export_or_unset() {
|
||||||
_nix_import_env() {
|
_nix_import_env() {
|
||||||
local profile_rc=$1
|
local profile_rc=$1
|
||||||
|
|
||||||
local old_nix_build_top=${NIX_BUILD_TOP:-__UNSET__}
|
local -A values_to_restore=(
|
||||||
local old_tmp=${TMP:-__UNSET__}
|
["NIX_BUILD_TOP"]=${NIX_BUILD_TOP:-__UNSET__}
|
||||||
local old_tmpdir=${TMPDIR:-__UNSET__}
|
["TMP"]=${TMP:-__UNSET__}
|
||||||
local old_temp=${TEMP:-__UNSET__}
|
["TMPDIR"]=${TMPDIR:-__UNSET__}
|
||||||
local old_tempdir=${TEMPDIR:-__UNSET__}
|
["TEMP"]=${TEMP:-__UNSET__}
|
||||||
|
["TEMPDIR"]=${TEMPDIR:-__UNSET__}
|
||||||
|
["terminfo"]=${terminfo:-__UNSET__}
|
||||||
|
)
|
||||||
local old_xdg_data_dirs=${XDG_DATA_DIRS:-}
|
local old_xdg_data_dirs=${XDG_DATA_DIRS:-}
|
||||||
|
|
||||||
# On the first run in manual mode, the profile_rc does not exist.
|
# On the first run in manual mode, the profile_rc does not exist.
|
||||||
|
|
@ -153,11 +156,10 @@ _nix_import_env() {
|
||||||
rm -rf "$NIX_BUILD_TOP"
|
rm -rf "$NIX_BUILD_TOP"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_nix_export_or_unset NIX_BUILD_TOP "$old_nix_build_top"
|
for key in "${!values_to_restore[@]}"; do
|
||||||
_nix_export_or_unset TMP "$old_tmp"
|
_nix_export_or_unset "$key" "${values_to_restore[${key}]}"
|
||||||
_nix_export_or_unset TMPDIR "$old_tmpdir"
|
done
|
||||||
_nix_export_or_unset TEMP "$old_temp"
|
|
||||||
_nix_export_or_unset TEMPDIR "$old_tempdir"
|
|
||||||
local new_xdg_data_dirs=${XDG_DATA_DIRS:-}
|
local new_xdg_data_dirs=${XDG_DATA_DIRS:-}
|
||||||
export XDG_DATA_DIRS=
|
export XDG_DATA_DIRS=
|
||||||
local IFS=:
|
local IFS=:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue