Skip to content

Commit a08c28f

Browse files
authored
fix: cleanup script subshell and process list (#3846)
- Add sequencer-sqlite to NATIVE_PROCESSES list - Fix pgrep pipe subshell issue where we were killing the running process because of the subshell. - Use pgrep -fA for full argument matching
1 parent 8b31028 commit a08c28f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

scripts/cleanup-process-compose

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ get_proc_cwd() {
4444
# Update this list when adding/removing processes in process-compose.yaml
4545
NATIVE_PROCESSES=(
4646
sequencer
47+
sequencer-sqlite
4748
orchestrator
4849
state-relay-server
4950
cdn-marshal
@@ -62,13 +63,17 @@ kill_project_processes() {
6263
local proc_name=$1
6364
local signal=$2
6465

65-
pgrep "$proc_name" 2>/dev/null | while read -r pid; do
66+
# Collect PIDs first to avoid subshell issues when killing
67+
local pids
68+
pids=$(pgrep -fA "$proc_name" 2>/dev/null) || true
69+
70+
for pid in $pids; do
6671
local proc_cwd
6772
proc_cwd=$(get_proc_cwd "$pid")
6873

6974
if [[ -n "$proc_cwd" && "$proc_cwd" == "$PROJECT_DIR"* ]]; then
7075
echo "Killing $proc_name (pid $pid) from $proc_cwd"
71-
kill -"$signal" "$pid" 2>/dev/null || true
76+
kill -"$signal" "$pid" || true
7277
fi
7378
done
7479
}

0 commit comments

Comments
 (0)