mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
One more fix
This commit is contained in:
parent
bafa997a70
commit
a68cf97f89
1 changed files with 10 additions and 3 deletions
|
|
@ -4,12 +4,19 @@
|
||||||
|
|
||||||
# Function to remove shim from PATH (POSIX-compliant)
|
# Function to remove shim from PATH (POSIX-compliant)
|
||||||
remove_shim_from_path() {
|
remove_shim_from_path() {
|
||||||
_safe_chain_shims=$(CDPATH= cd -- "$(dirname -- "$0")" 2>/dev/null && pwd -P)
|
_safe_chain_phys=$(CDPATH= cd -- "$(dirname -- "$0")" 2>/dev/null && pwd -P)
|
||||||
if [ -z "$_safe_chain_shims" ]; then
|
if [ -z "$_safe_chain_phys" ]; then
|
||||||
echo "$PATH"
|
echo "$PATH"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
echo "$PATH" | sed "s|${_safe_chain_shims}:||g"
|
_path=$(echo "$PATH" | sed "s|${_safe_chain_phys}:||g")
|
||||||
|
# Also remove via dirname of $0 directly — on macOS /tmp is a symlink to /private/tmp,
|
||||||
|
# so pwd -P resolves to /private/tmp/… but PATH may still contain /tmp/….
|
||||||
|
_dir=$(dirname -- "$0")
|
||||||
|
case "$_dir" in
|
||||||
|
/*) [ "$_dir" != "$_safe_chain_phys" ] && _path=$(echo "$_path" | sed "s|${_dir}:||g") ;;
|
||||||
|
esac
|
||||||
|
echo "$_path"
|
||||||
}
|
}
|
||||||
|
|
||||||
if command -v safe-chain >/dev/null 2>&1; then
|
if command -v safe-chain >/dev/null 2>&1; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue