Skip to content

Commit 905ed72

Browse files
committed
Detect if PPID is empty and then ignore
Fixes #25.
1 parent 18a26d3 commit 905ed72

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

scripts/snap-pac

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ set -o errtrace
2525
readonly argv0="snap-pac"
2626
readonly SNAPPAC_CONFIG_FILE=/etc/snap-pac.conf
2727
readonly SNAPPER_CONFIG_FILE=/etc/conf.d/snapper
28-
readonly pacman_cmd="$(ps -q $(ps -p "$$" -o ppid=) -o args=)"
28+
if [ -z $PPID ] || [ -z $(ps -q $PPID -o args=) ]; then
29+
printf "Parent process ID is empty.\n"
30+
readonly pacman_cmd=""
31+
else
32+
readonly pacman_cmd="$(ps -q $PPID -o args=)"
33+
fi
2934
readonly pre_or_post=$1
3035

3136
out() { printf "$1 $2\n" "${@:3}"; }

0 commit comments

Comments
 (0)