mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Invoke path_helper on macOS on all sessions, not just login
fish reads paths out of /etc/paths.d. Prior toadbaddf
it did this on every shell invocation; withadbaddf
it does so on only login shells. This change wasn't justified so let's revert this behavior.
This commit is contained in:
parent
535617623b
commit
c0f832a743
1 changed files with 35 additions and 33 deletions
|
@ -200,15 +200,12 @@ if not set -q __fish_init_2_3_0
|
||||||
set -U __fish_init_2_3_0
|
set -U __fish_init_2_3_0
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
# macOS-ism: Emulate calling path_helper.
|
||||||
# Some things should only be done for login terminals
|
if command -sq /usr/libexec/path_helper
|
||||||
# This used to be in etc/config.fish - keep it here to keep the semantics
|
# Adapt construct_path from the macOS /usr/libexec/path_helper
|
||||||
#
|
# executable for fish; see
|
||||||
|
# https://opensource.apple.com/source/shell_cmds/shell_cmds-203/path_helper/path_helper.c.auto.html .
|
||||||
# Adapt construct_path from the macOS /usr/libexec/path_helper
|
function __fish_macos_set_env -d "set an environment variable like path_helper does (macOS only)"
|
||||||
# executable for fish; see
|
|
||||||
# https://opensource.apple.com/source/shell_cmds/shell_cmds-203/path_helper/path_helper.c.auto.html .
|
|
||||||
function __fish_macos_set_env -d "set an environment variable like path_helper does (macOS only)"
|
|
||||||
set -l result
|
set -l result
|
||||||
|
|
||||||
for path_file in $argv[2] $argv[3]/*
|
for path_file in $argv[2] $argv[3]/*
|
||||||
|
@ -228,17 +225,22 @@ function __fish_macos_set_env -d "set an environment variable like path_helper d
|
||||||
end
|
end
|
||||||
|
|
||||||
set -xg $argv[1] $result
|
set -xg $argv[1] $result
|
||||||
end
|
end
|
||||||
|
|
||||||
if status --is-login
|
|
||||||
# macOS-ism: Emulate calling path_helper.
|
|
||||||
if command -sq /usr/libexec/path_helper
|
|
||||||
__fish_macos_set_env 'PATH' '/etc/paths' '/etc/paths.d'
|
__fish_macos_set_env 'PATH' '/etc/paths' '/etc/paths.d'
|
||||||
if [ -n "$MANPATH" ]
|
if [ -n "$MANPATH" ]
|
||||||
__fish_macos_set_env 'MANPATH' '/etc/manpaths' '/etc/manpaths.d'
|
__fish_macos_set_env 'MANPATH' '/etc/manpaths' '/etc/manpaths.d'
|
||||||
end
|
end
|
||||||
end
|
functions -e __fish_macos_set_env
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Some things should only be done for login terminals
|
||||||
|
# This used to be in etc/config.fish - keep it here to keep the semantics
|
||||||
|
#
|
||||||
|
|
||||||
|
if status --is-login
|
||||||
#
|
#
|
||||||
# Put linux consoles in unicode mode.
|
# Put linux consoles in unicode mode.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue