mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-07 20:31:01 -05:00
Fix detecting parent shell on OpenBSD and Cygwin
It seems that "comm" header can't be relied on cross-platform, but that "ucomm" is more portable. I have no idea whether it's the right value to use here, but it seems to be doing the job. Also strip trailing whitespace because OpenBSD 5.4 `ps` output is padded with spaces for some reason. Fixes #489
This commit is contained in:
parent
eda535a942
commit
1a6bada94c
1 changed files with 2 additions and 1 deletions
|
@ -22,8 +22,9 @@ done
|
|||
|
||||
shell="$1"
|
||||
if [ -z "$shell" ]; then
|
||||
shell="$(ps c -p $(ps -p $$ -o 'ppid=' 2>/dev/null) -o 'comm=' 2>/dev/null || true)"
|
||||
shell="$(ps c -p "$PPID" -o 'ucomm=' 2>/dev/null || true)"
|
||||
shell="${shell##-}"
|
||||
shell="${shell%% *}"
|
||||
shell="$(basename "${shell:-$SHELL}")"
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue