fix: isolate dind cleanup subprocesses from Ctrl+C SIGINT#3
Draft
fix: isolate dind cleanup subprocesses from Ctrl+C SIGINT#3
Conversation
…Ctrl+C When Ctrl+C is pressed the terminal SIGINT is broadcast to the entire foreground process group. The docker stop/rm/network-rm subprocesses spawned by Stop() were in that group and exited with code 130 before completing, leaving the dind container and network running. - Add setSysProcAttr() (platform-specific) to place each cleanup subprocess in its own process group (Setpgid: true on Unix), shielding it from the terminal's SIGINT. - Replace docker stop + docker rm with docker rm -f, which force-kills and removes the container atomically, eliminating the "container is running" error even if the stop step were somehow interrupted. Co-authored-by: mtsfoni <80639729+mtsfoni@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix error when exiting with ctrl+c during container operations
fix: isolate dind cleanup subprocesses from Ctrl+C SIGINT
Feb 22, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Pressing Ctrl+C broadcasts SIGINT to the entire foreground process group, which killed the
docker stop/docker rm/docker network rmsubprocesses inStop()before they could complete — leaving the dind container and network alive and producing the cascade of errors.Changes
run()helper — callssetSysProcAttr(cmd), which setsSetpgid: trueon Unix, placing each cleanup subprocess in its own process group and shielding it from the terminal's SIGINTStop()— replaces two-stepdocker stop+docker rmwith atomicdocker rm -f, eliminating the race window between the two callssysattr_unix.go/sysattr_windows.go— platform build tags to keepsyscall.SysProcAttrout of the Windows build pathOriginal prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.