-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Gradle doesn't correctly kill subprocesses on interrupt on Windows. It should. #18716
Comments
Thanks for your interest in Gradle! Could you please improve the title and description of the issue to be less passive-aggressive please? |
Terminating a single process does not terminate its children automatically, so when Gradle terminates .bat file, it leaves the forked application running. The problem is often visible as "process exec process keeps running after build termination". The root cause is that in Windows exec uses cmd -> process.exe sequence, so aborting the build terminates "cmd.exe", and "process.exe" keeps running. The workaround is to use taskkill /PID $pid /T /F command that terminates the process tree For other operating systems, alternative solutions are needed. This commit uses Process#descendants if Gradle runs with Java 9+ Otherwise it resorts to the previous "process.destroy" sequence. fixes gradle#18716 gradle#7603 gradle#6114 gradle#3093 gradle#1128 gradle#1109 Signed-off-by: Vladimir Sitnikov <[email protected]>
This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you're interested in how we try to keep the backlog in a healthy state, please read our blog post on how we refine our backlog. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution. |
Sorry for the late reply! Thank you for your interest in Gradle! This issue will be closed as a duplicate of Please add your use case and 👍 to that issue. #7603 has a PR with a fix. Unfortunately, we don't have the capacity to push it right now, but it is in the backlog of the relevant team. |
cmd
,powershell
or thebash
that ships withgit
.gradle
task with anexec
that never finishes.exec
is not terminated.Numerous people report issues related to this: #7603 #6114 #3093 #1128 #1109
I fixed this issue in NuProcess - brettwooldridge/NuProcess#133 - which you should use instead of
ProcessBuilder
on Windows. You will need to ping them to merge my PR.You can trap Ctrl+C and use it to kill the subprocesses using NuProcess, or permit Ctrl+C to kill the daemon and using NuProcess, result in the child processes being terminated correctly.
Otherwise, Gradle is working really great for me.
The text was updated successfully, but these errors were encountered: