Skip to content

Commit

Permalink
Fix error when running in container (kerl#402)
Browse files Browse the repository at this point in the history
Add a check that looking up the parent PID of process 0 doesn't fail
  • Loading branch information
winks committed Nov 30, 2022
1 parent e00d48c commit bab1868
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kerl
Original file line number Diff line number Diff line change
Expand Up @@ -1492,11 +1492,13 @@ ACTIVATE_CSH
build_plt "$absdir"
fi

PID=$$
if command -v apk >/dev/null 2>&1; then
# Running on Alpine Linux, assuming non-exotic shell
SHELL_SUFFIX=''
elif [ "$(\ps -p $PID -o ppid=)" -eq 0 ]; then
SHELL_SUFFIX=''
else
PID=$$
PARENT_PID=$(\ps -p $PID -o ppid=) || exit 1
# shellcheck disable=SC2086
PARENT_CMD=$(\ps -p $PARENT_PID -o ucomm | tail -n 1)
Expand Down

0 comments on commit bab1868

Please sign in to comment.