Skip to content

Commit c28ae70

Browse files
committed
Make the Linux/macOS installer parent-independant
1 parent d815c73 commit c28ae70

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

docs/install.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,29 @@
22

33
# error handling
44
set -e
5-
set -x
65
set -u
76

7+
# self-extract process
8+
if [ "${EXTRACTED:-0}" != "1" ]; then
9+
export EXTRACTED=1
10+
11+
# store parent (fkn) PID
12+
OLD_PPID=$PPID
13+
PARENT=$(ps -p $PPID -o comm=)
14+
15+
# rerun on a new "orphan" process
16+
setsid "$0" "$@" &
17+
18+
# if possible, kill the parent
19+
# that sounds so wrong omg
20+
if [[ "$PARENT" == *"FuckingNode"* ]]; then
21+
kill "$OLD_PPID" 2>/dev/null
22+
fi
23+
24+
# exit the child process
25+
exit
26+
fi
27+
828
# constants
929
APP_NAME="FuckingNode"
1030
CLI_NAME="fuckingnode"

0 commit comments

Comments
 (0)