-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: wrap Makefile subshell cd commands in parentheses #3333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
akshaydeo
merged 1 commit into
dev
from
fix/05-08-fix_wrap_makefile_subshell_cd_commands_in_parentheses
May 14, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kill the full process tree during
make devcleanup.This cleanup only targets direct children of the tracked subshell. With the process chain started at Line 225, that can kill the shell and its first child while leaving a deeper long-lived child behind, so the next
make devcan come up with a stale process still holding$(PORT).♻️ Suggested fix
cleanup() { \ $(ECHO) "$(YELLOW)[make dev] cleanup started; ui_pid=$$ui_pid api_pid=$$api_pid$(NC)"; \ trap - EXIT INT TERM HUP; \ + kill_tree() { \ + local sig="$$1" pid="$$2" child; \ + for child in $$(pgrep -P "$$pid" 2>/dev/null || true); do \ + kill_tree "$$sig" "$$child"; \ + done; \ + kill -s "$$sig" "$$pid" 2>/dev/null || true; \ + }; \ for pid in "$$ui_pid" "$$api_pid"; do \ if [ -n "$$pid" ]; then \ - children="$$(pgrep -P "$$pid" 2>/dev/null || true)"; \ - $(ECHO) "$(YELLOW)[make dev] sending TERM to pid $$pid and children: $${children:-none}$(NC)"; \ - kill -TERM $$children "$$pid" 2>/dev/null || true; \ + $(ECHO) "$(YELLOW)[make dev] sending TERM to pid $$pid tree$(NC)"; \ + kill_tree TERM "$$pid"; \ fi; \ done; \ sleep 1; \ for pid in "$$ui_pid" "$$api_pid"; do \ if [ -n "$$pid" ]; then \ - children="$$(pgrep -P "$$pid" 2>/dev/null || true)"; \ - $(ECHO) "$(YELLOW)[make dev] sending KILL to pid $$pid and remaining children: $${children:-none}$(NC)"; \ - kill -KILL $$children "$$pid" 2>/dev/null || true; \ + $(ECHO) "$(YELLOW)[make dev] sending KILL to pid $$pid tree$(NC)"; \ + kill_tree KILL "$$pid"; \ fi; \ done; \🤖 Prompt for AI Agents