Skip to content

Commit cfe7745

Browse files
committed
update script
1 parent 06947eb commit cfe7745

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

node/release_autorun.sh

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@ start_process() {
55
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
66
if [[ $arch == arm* ]]; then
77
./node-$version-linux-arm64 &
8+
main_process_id=$!
89
else
910
./node-$version-linux-amd64 &
11+
main_process_id=$!
1012
fi
1113
elif [[ "$OSTYPE" == "darwin"* ]]; then
1214
./node-$version-darwin-arm64 &
15+
main_process_id=$!
1316
else
1417
echo "unsupported OS for releases, please build from source"
1518
exit 1
1619
fi
17-
main_process_id=$!
18-
local child_process_pid=$(pgrep -P $main_process_id)
19-
echo "process started with PID $main_process_id and child PID $child_process_pid"
20+
21+
echo "process started with PID $main_process_id"
2022
}
2123

2224
is_process_running() {
@@ -25,21 +27,12 @@ is_process_running() {
2527
}
2628

2729
kill_process() {
28-
local process_count=$(ps -ef | grep "exe/node" | grep -v grep | wc -l)
29-
local process_pids=$(ps -ef | grep "exe/node" | grep -v grep | awk '{print $2}' | xargs)
30+
local process_count=$(ps -ef | grep "node-$version" | grep -v grep | wc -l)
31+
local process_pids=$(ps -ef | grep "node-$version" | grep -v grep | awk '{print $2}' | xargs)
3032

3133
if [ $process_count -gt 0 ]; then
3234
echo "killing processes $process_pids"
3335
kill $process_pids
34-
35-
local child_process_count=$(pgrep -P $process_pids | wc -l)
36-
local child_process_pids=$(pgrep -P $process_pids | xargs)
37-
if [ $child_process_count -gt 0 ]; then
38-
echo "killing child processes $child_process_pids"
39-
kill $child_process_pids
40-
else
41-
echo "no child processes running"
42-
fi
4336
else
4437
echo "no processes running"
4538
fi

0 commit comments

Comments
 (0)